I am trying to orchestrate a downloading of files with aria2 tool. There is an example in the documentation like:
import urllib2, json
jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
'method':'aria2.addUri',
'params':[['http://example.org/file']]})
c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
c.read()
# The result:
# '{"id":"qwer","jsonrpc":"2.0","result":"2089b05ecca3d829"}'
It starts download of http://example.org/file
and returns some GID (download ID) 2089b05ecca3d829
...
Aria2 supports notifications. But no any examples how to get a notification, for example, onDownloadComplete, onDownloadError, etc. I assume, there is a way to request the aria2 to call me through JSON-RPC (HTTP) on some (my) IP and port. But I cannot find a way how to request aria2 to do it (how to subscribe to the notifications with my IP, port). Any example in Python, Ruby or similar will be very helpful.