Welcome to transmission-rpc’s documentation!

transmission-rpc is a python3 library to help your control your transmission daemon remotely.

quick start

from transmission_rpc import Client

torrent_url = 'http://releases.ubuntu.com/' + \
              '18.04/ubuntu-18.04.1-desktop-amd64.iso.torrent'
c = Client(host='localhost', port=9091, username='transmission', password='password')
c.add_torrent(torrent_url)

########

from transmission_rpc import Client

c = Client(username='transmission', password='password')

torrent_url = 'magnet:?xt=urn:btih:e84213a794f3ccd890382a54' + \
              'a64ca68b7e925433&dn=ubuntu-18.04.1-desktop-amd64.iso'
c.add_torrent(torrent_url)

########

from transmission_rpc import Client
import requests

c = Client(username='trim21', password='123456')

torrent_url = 'http://releases.ubuntu.com/' + \
              '18.04/ubuntu-18.04.1-desktop-amd64.iso.torrent'
r = requests.get(torrent_url)

# client will base64 the torrent content for you.
c.add_torrent(r.content)

# or use a file-like object
with open('a', 'wb') as f:
    f.write(r.content)
with open('a', 'rb') as f:
    c.add_torrent(f)

client.add_torrent support a url string, file-like object(object with read() method) or base64 encoded torrent file content.

Arguments

Each method has it own arguments. You can pass arguments as kwargs when you call methods.

But in python, - can’t be used in a variable name, so you need to replace - with _.

For example, torrent-add method support arguments download-dir, you should call method like this.

from transmission_rpc import Client

Client().add_torrent(torrent_url, download_dir='/path/to/download/dir')

transmission-rpc will put {"download-dir": "/path/to/download/dir"} in arguments.

you can find rpc version by transmission version from transmission rpc docs

Indices and tables