Giter VIP home page Giter VIP logo

transmission's Introduction

Transmission JSON RPC client

This library implements a JSON RPC client for interacting with Transmission remotely.

For more information about the underlaying API, see the official documentation.

Versions

The master branch of this repository is compatible with the master branch of the upstream transmission project.

If you want to use this lib with transmission 2.94 please import this project using this command:

go get -u -v github.com/odwrtw/[email protected]

Usage

package main

import (
        "crypto/tls"
        "net/http"

        "github.com/kr/pretty"

        "github.com/odwrtw/transmission"
)

func main() {
        // Let's create a simple client
        conf := transmission.Config{
                Address: "http://localhost:9091/transmission/rpc",
        }
        t, err := transmission.New(conf)
        if err != nil {
                pretty.Println(err)
        }

        // With a self signed certificate
        tr := &http.Transport{
                TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
        }
        httpClient := http.Client{Transport: tr}

        conf = transmission.Config{
                Address:    "http://localhost:9091/transmission/rpc",
                HTTPClient: &httpClient,
        }
        t, err = transmission.New(conf)
        if err != nil {
                pretty.Println(err)
        }

        // Get all the torrents
        torrents, err := t.GetTorrents()
        if err != err {
                pretty.Println(err)
        }
        pretty.Println(torrents)

        // Add a torrent
        torrent, err := t.Add("http://cdimage.debian.org/debian-cd/8.1.0/amd64/bt-cd/debian-8.1.0-amd64-CD-1.iso.torrent")
        if err != nil {
                pretty.Println(err)
        }

        // Update it
        torrent.Update()
        pretty.Println(torrent)

        // Remove it
        err = t.RemoveTorrents([]*transmission.Torrent{torrent}, true)
        if err != nil {
                pretty.Println(err)
        }

        // Update and print the current session
        t.Session.Update()
        pretty.Println(t.Session)
}

transmission's People

Contributors

danackerson avatar gregdel avatar j00lz avatar nduhamel avatar pouulet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

transmission's Issues

Connections succeeds without credentials

Here's what I am using,

	// Simple client
        conf := transmission.Config{
		Address: fmt.Sprintf("http://%s:%s/transmission/rpc", host, "9091"),
		// User: username,
		// Password: password,
	}
	client, err := transmission.New(conf)
	if err != nil {
		log.Println(err)
	}

	// Get all torrents
	torrents, err := client.GetTorrents()
	if err != err {
		log.Println(err)
	}
	log.Println(torrents)

I have authentication enabled for transmission and as such connection (should) require username/password. However, if I skip passing credentials, the connection still succeeds when I was hoping for it to fail and throw some sort of error.

Is this behaviour expected?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.