rtorrent_rpc¶
- class RTorrent[source]¶
RTorrent rpc client
rt = RTorrent('scgi://127.0.0.1:5000') rt = RTorrent('scgi:///home/ubuntu/.local/rtorrent.sock')
If you are using ruTorrent or nginx scgi proxy, http(s) protocol are also supported
rt = RTorrent('http://127.0.0.1')
by default,
/RPC2
path is used.- __init__(address: str, rutorrent_compatibility: bool = True)[source]¶
- Parameters:
address – rtorrent rpc address
rutorrent_compatibility – compatibility for ruTorrent or flood.
- rpc: ServerProxy¶
Underling
xmlrpc.client.ServerProxy
are exposed as instance property.rpc
, you can usert.rpc
for direct rpc call.
- add_torrent_by_file(content: bytes, directory_base: str, tags: Iterable[str] | None = None) None [source]¶
Add a torrent to the client by providing the torrent file content as bytes.
Note
rTorrent need some time to handle your torrent, there is a chance info_hash of the torrent you just added is not inoperable. In that case, you need wait some time after you just add a torrent.
- Parameters:
content – The content of the torrent file as bytes.
directory_base – The base directory where the downloaded files will be saved.
tags – A sequence of tags associated with the torrent. Defaults to None. This argument is compatible with ruTorrent and flood.
- stop_torrent(info_hash: str) None [source]¶
Stop and close a torrent.
- Parameters:
info_hash (str) – The info hash of the torrent to be stopped.
- Returns:
This function does not return anything.
- Return type:
None
- property system: _SystemRpc¶
method call with
system
prefixrt.system.listMethods(...)
- property d: _DownloadRpc¶
method call with
d
prefixrt.d.save_resume(...) rt.d.open(...)
- d_set_torrent_base_directory(info_hash: str, directory: str) None [source]¶
change base directory of a download.
you may need to stop/close torrent first.
- d_set_tags(info_hash: str, tags: Iterable[str]) None [source]¶
set download tags, work with flood and ruTorrent.
- d_set_comment(info_hash: str, comment: str) None [source]¶
Set comment, work with flood and ruTorrent
- d_set_custom(info_hash: str, key: str, value: str) int [source]¶
set custom key value pair on download
- d_get_custom(info_hash: str, key: str) str [source]¶
get custom value by key, return empty str if key not set
- property t: _TrackerRpc¶
method call with
t
prefixrt.t.is_enabled(...)
- property f: _FileRpc¶
method call with
d
prefixrt.f.multicall("<info_hash>", "", "f.path=")
- class _DownloadRpc[source]¶
this is not a real class, it’s a typing protocol for rpc typing
- multicall2(_: Literal[''], view: str, *commands: str) Iterable[Any] [source]¶
run multiple rpc calls
- property directory_base: _DirectoryRpc¶
base directory
- property directory: _DirectoryRpc¶
- __init__(*args, **kwargs)¶
- class _SystemRpc[source]¶
this is not a real class, it’s a typing protocol for rpc typing
- __init__(*args, **kwargs)¶
- class _TrackerRpc[source]¶
this is not a real class, it’s a typing protocol for rpc typing
- multicall(info_hash: str, _: Literal[''], *commands: str) Iterable[Any] [source]¶
run multiple rpc calls
- __init__(*args, **kwargs)¶
- class JSONRpc[source]¶
this class is exposed as
RTorrent(...).jsonrpc
, you do not need to construct it by yourself.
- Unknown¶
alias of
Any