Helper class for ease interaction with aria2's XMLRPC interface.
All aria2 methods require the first parameter to be the RPC Secret. This makes us pass the token for each rpc like:
from xmlrpc.client import ServerProxy
RPC_TOKEN = 'token:rpc_secret_token'
aria2 = ServerProxy(url="http://aria2-host:6800/rpc").aria2
aria2.getVersion(RPC_TOKEN)
aria2.addURI(RPC_TOKEN, ['https://piratebay.org/torrents/ubuntu.iso.torrent'])
system = ServerProxy(url="http://aria2-host:6800/rpc").system
system.listMethods()
system.listNotifications()
Is simplified into:
from .downloaders import Aria2
aria2 = Aria2().aria2
aria2.getVersion()
aria2.addURI(['https://piratebay.org/torrents/ubuntu.iso.torrent'])
system = Aria2().system
system.listMethods()