transmission-rpc
raw JSON → 7.0.11 verified Fri May 01 auth: no python
Python module that implements the Transmission BitTorrent client JSON-RPC protocol. Current stable version is 7.0.11, requires Python ~=3.8. Pre-release version 8.0.0a4 is available with breaking changes. Maintained by Trim21. Active development.
pip install transmission-rpc Common errors
error ModuleNotFoundError: No module named 'transmissionrpc' ↓
cause Using old deprecated package name with underscore missing.
fix
Install transmission-rpc and use 'from transmission_rpc import Client'.
error transmission_rpc.error.TransmissionError: Couldn't connect to server ↓
cause Incorrect host, port, or authentication credentials, or Transmission RPC not enabled.
fix
Verify Transmission settings: enable 'rpc-whitelist' and set 'rpc-port'. Check host, port, username, password.
error AttributeError: 'Torrent' object has no attribute 'pieces' ↓
cause Using v8.0.0a0+ where .pieces returns a BitMap instead of base64 string; property name may have changed.
fix
If on v8+, use 'bytes(t.pieces)' or check for 'bitfield' attribute. Use older v7 if compatibility needed.
Warnings
breaking Version 8.0.0a0+ removed the 'requests' library dependency and changed '.pieces' from base64 string to BitMap object. Code relying on old .pieces format will break. ↓
fix Use 'bytes(pieces)' or access BitMap methods. See changelog for migration path.
deprecated The old import 'import transmissionrpc' (no underscore) is deprecated and will be removed. Always use 'transmission_rpc'. ↓
fix Replace 'import transmissionrpc' with 'import transmission_rpc'.
gotcha When calling change_torrent(tracker_list=...), setting tiers correctly requires a specific list format. Passing a flat list may not preserve tiers. ↓
fix Use a list of lists: [[tracker1, tracker2], [tracker3]] for two tiers.
breaking In version 8.0.0a3, return types for 'peers' and 'peers_from' changed. Code expecting old types may break. ↓
fix Update type annotations and attribute access accordingly.
Imports
- Client wrong
from transmissionrpc import Clientcorrectfrom transmission_rpc import Client - Torrent
from transmission_rpc import Torrent
Quickstart
from transmission_rpc import Client
c = Client(host='localhost', port=9091, username=os.environ.get('TR_USER', ''), password=os.environ.get('TR_PASS', ''))
torrents = c.get_torrents()
for t in torrents:
print(t.name, t.percent_done)