PK!TT README.md# Aria2p Command-line tool and Python library to interact with an `aria2c` daemon process through JSON-RPC. ## Requirements `aria2p` requires Python 3.6 or above.
To install Python 3.6, I recommend using pyenv. ```bash # install pyenv git clone https://github.com/pyenv/pyenv ~/.pyenv # setup pyenv (you should also put these two lines in .bashrc or similar) export PATH="${HOME}/.pyenv/bin:${PATH}" eval "$(pyenv init -)" # install Python 3.6 pyenv install 3.6.7 # make it available globally pyenv global system 3.6.7 ```
## Installation With `pip`: ```bash python3.6 -m pip install aria2p ``` With [`pipx`](https://github.com/cs01/pipx): ```bash # install pipx with the recommended method curl https://raw.githubusercontent.com/cs01/pipx/master/get-pipx.py | python3 pipx install --python python3.6 aria2p ``` ## Usage (as a library) **This library is still a work in progress. Some things listed here might not be implemented yet.** ```python import aria2p # initialization, these are the default values aria2 = aria2p.API( aria2p.JSONRPCClient( host="http://localhost", port=6800, secret="" ) ) # list downloads downloads = aria2.get_downloads() for download in downloads: print(download.name, download.download_speed) # add downloads magnet_uri = "magnet:?xt=urn:..." download = aria2.add_magnet(magnet_uri) ``` ## Usage (command-line) For now, the command-line tool can only call methods using the client. More options directly using the API will come later. ```bash aria2p -m,--method METHOD_NAME [-p,--params PARAMS... | -j,--json-params JSON_STRING] ``` The `METHOD_NAME` can be the exact method name, or just the name without the prefix. It is case-insensitive, and dashes and underscores will be removed. The following are all equivalent: - `aria2.addUri` - `aria2.adduri` - `addUri` - `ADDURI` - `aria2.ADD-URI` - `add_uri` - `A-d_D-u_R-i` (yes it's valid) - `A---R---I---A---2.a__d__d__u__r__i` (I think you got it) - and even more ugly forms... Calling `aria2p` without any arguments will simply display the list of current downloads: ``` GID STATUS PROGRESS DOWN_SPEED UP_SPEED ETA NAME ``` There is no interactive mode yet, but you can use `watch` to see how the downloads progress: ```bash watch -d -t -n1 aria2p ``` ### Examples List all available methods. *This example uses [`jq`](https://github.com/stedolan/jq).* ```console $ aria2p -m listmethods | jq [ "aria2.addUri", "aria2.addTorrent", "aria2.getPeers", "aria2.addMetalink", "aria2.remove", "aria2.pause", "aria2.forcePause", "aria2.pauseAll", "aria2.forcePauseAll", "aria2.unpause", "aria2.unpauseAll", "aria2.forceRemove", "aria2.changePosition", "aria2.tellStatus", "aria2.getUris", "aria2.getFiles", "aria2.getServers", "aria2.tellActive", "aria2.tellWaiting", "aria2.tellStopped", "aria2.getOption", "aria2.changeUri", "aria2.changeOption", "aria2.getGlobalOption", "aria2.changeGlobalOption", "aria2.purgeDownloadResult", "aria2.removeDownloadResult", "aria2.getVersion", "aria2.getSessionInfo", "aria2.shutdown", "aria2.forceShutdown", "aria2.getGlobalStat", "aria2.saveSession", "system.multicall", "system.listMethods", "system.listNotifications" ] ``` List the GIDs (identifiers) of all active downloads. *Note that we must give the parameters as a JSON string.* ```console $ aria2p -m tellactive -j '[["gid"]]' [{"gid": "b686cad55029d4df"}, {"gid": "4b39a1ad8fd94e26"}, {"gid": "9d331cc4b287e5df"}, {"gid": "8c9de0df753a5195"}] ``` Pause a download using its GID. *Note that when a single string argument is required, it can be passed directly with `-p`.* ```console $ aria2p -m pause -p b686cad55029d4df "b686cad55029d4df" ``` Add a download using magnet URIs. *This example uses `jq -r` to remove the quotation marks around the result.* ```console $ aria2p -m adduri -j '[["magnet:?xt=urn:..."]]' | jq -r 4b39a1ad8fd94e26f ``` Purge download results (remove completed downloads from the list). ```console $ aria2p -m purge_download_result "OK" ``` PK! I||aria2p/__init__.py""" Aria2p package. This package provides a command-line tool and a Python library to interact with an `aria2c` daemon process through JSON-RPC. If you read this message, you probably want to learn about the library and not the command-line tool: please refer to the README.md included in this package to get the link to the official documentation. """ from .api import API from .client import JSONRPCClient, JSONRPCError from .downloads import Download, BitTorrent, File from .options import Options from .stats import Stats __all__ = ["API", "JSONRPCError", "JSONRPCClient", "Download", "BitTorrent", "File", "Options", "Stats"] PK!\逊aria2p/__main__.py""" Entry-point module, in case you use `python -maria2p`. Why does this file exist, and why __main__? For more info, read: - https://www.python.org/dev/peps/pep-0338/ - https://docs.python.org/2/using/cmdline.html#cmdoption-m - https://docs.python.org/3/using/cmdline.html#cmdoption-m """ import sys from aria2p.cli import main if __name__ == "__main__": sys.exit(main(sys.argv[1:])) PK!WU$$ aria2p/api.py""" This module defines the API class, which makes use of a JSON-RPC client to provide higher-level methods to interact easily with a remote aria2c process. """ from .downloads import Download from .options import Options from .stats import Stats class API: """ A class providing high-level methods to interact with a remote aria2c process. This class is instantiated with a reference to a :class:`client.JSONRPCClient` instance. It then uses this client to call remote procedures, or remote methods. The client methods reflect exactly what aria2c is providing through JSON-RPC, while this class's methods allow for easier / faster control of the remote process. It also wraps the information the client retrieves in Python object, like :class:`downloads.Download`, allowing for even more Pythonic interactions, without worrying about payloads, responses, JSON, etc.. """ def __init__(self, json_rpc_client): self.client = json_rpc_client self.downloads = {} self.options = None self.stats = None def fetch(self): self.fetch_downloads() self.fetch_stats() def fetch_downloads(self): self.downloads.clear() self.downloads = {d.gid: d for d in self.get_downloads()} def fetch_options(self): self.options = Options(self, self.client.get_global_option) def fetch_stats(self): self.stats = Stats(self.client.get_global_stat()) def add_magnet(self, magnet_uri): pass def add_torrent(self, torrent_file): pass def add_metalink(self, metalink): pass def add_url(self, url): pass def add_download(self, download): pass def find(self, patterns): pass def get_gid(self, filter): pass def get_gids(self, filters=None): gids = [] gids.extend(self.client.tell_active(keys=["gid"])) gids.extend(self.client.tell_waiting(0, 1000, keys=["gid"])) gids.extend(self.client.tell_stopped(0, 1000, keys=["gid"])) return gids def get_download(self, gid): if gid in self.downloads: return self.downloads[gid] return Download(self, self.client.tell_status(gid)) def get_downloads(self, gids=None): downloads = [] if gids: for gid in gids: if gid in self.downloads: downloads.append(self.downloads[gid]) else: downloads.append(Download(self, self.client.tell_status(gid))) else: downloads.extend(self.client.tell_active()) downloads.extend(self.client.tell_waiting(0, 1000)) downloads.extend(self.client.tell_stopped(0, 1000)) downloads = [Download(self, d) for d in downloads] return downloads def move(self, download, pos): return self.client.change_position(download.gid, pos, "POS_SET") def move_up(self, download, pos=1): return self.client.change_position(download.gid, -pos, "POS_CUR") def move_down(self, download, pos=1): return self.client.change_position(download.gid, pos, "POS_CUR") def move_to_top(self, download): return self.client.change_position(download.gid, 0, "POS_SET") def move_to_bottom(self, download): return self.client.change_position(download.gid, -1, "POS_SET") def remove(self, downloads): return [self.client.remove(d.gid) for d in downloads] def pause(self, downloads=None): if not downloads: return self.client.pause_all() return [self.client.pause(d.gid) for d in downloads] def resume(self, downloads=None): if not downloads: return self.client.unpause_all() return [self.client.unpause(d.gid) for d in downloads] def get_options(self, gids=None): if not gids: return Options(self, self.client.get_global_option()) options = {} for gid in gids: options[gid] = Options(self, self.client.get_option(gid), gid) return options def set_options(self, options, gids=None): if not gids: return self.client.change_global_option(options) results = {} for gid in gids: results[gid] = self.client.change_option(gid, options) return results PK!?55 5 aria2p/cli.py""" Module that contains the command line application. Why does this file exist, and why not put this in __main__? You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice: - When you run `python -maria2p` python will execute ``__main__.py`` as a script. That means there won't be any ``aria2p.__main__`` in ``sys.modules``. - When you import __main__ it will get executed again (as a module) because there's no ``aria2p.__main__`` in ``sys.modules``. Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration """ import argparse import json import sys from datetime import timedelta from .api import API from .client import JSONRPCClient, JSONRPCError def get_method(name, default=None): """Return the actual method name from a differently formatted name.""" methods = {} for method in JSONRPCClient.METHODS: methods[method.lower()] = method methods[method.split(".")[1].lower()] = method name = name.lower() name = name.replace("-", "") name = name.replace("_", "") return methods.get(name, default) def get_parser(): """Return a parser for the command-line options and arguments.""" parser = argparse.ArgumentParser() mutually_exclusive = parser.add_mutually_exclusive_group() rpc_group = mutually_exclusive.add_argument_group() rpc_group.add_argument("-m", "--method", dest="method") rpc_params_group = rpc_group.add_mutually_exclusive_group() rpc_params_group.add_argument("-p", "--params", dest="params", nargs="+") rpc_params_group.add_argument("-j", "--json-params", dest="json_params") # general_group = mutually_exclusive.add_argument_group() # sub-commands: list, add, pause, resume, stop, remove, search, info # use click? return parser def main(args=None): """The main function, which is executed when you type ``aria2p`` or ``python -m aria2p``.""" client = JSONRPCClient() parser = get_parser() args = parser.parse_args(args=args) if args.method: method = get_method(args.method) params = [] if args.params: params = args.params elif args.json_params: params = json.loads(args.json_params) if method is None: print(f"Unknown method {args.method}. Run '{sys.argv[0]} -m listmethods' to list the available methods.") return 1 try: response = client.call(method, params) except JSONRPCError as e: print(e.message) return e.code else: print(json.dumps(response)) return 0 api = API(client) try: downloads = api.get_downloads() except Exception as e: print(e) return 1 print(f"{'GID':<17} " f"{'STATUS':<9} " f"{'PROGRESS':>8} " f"{'DOWN_SPEED':>12} " f"{'UP_SPEED':>12} " f"{'ETA':>8} " f"NAME") for download in downloads: print(f"{download.gid:<17} " f"{download.status:<9} " f"{download.progress_string():>8} " f"{download.download_speed_string():>12} " f"{download.upload_speed_string():>12} " f"{download.eta_string():>8} " f"{download.name}") return 0 PK!s͞aria2p/client.py""" This module defines the JSONRPCError and JSONRPCClient classes, which are used to communicate with a remote aria2c process through the JSON-RPC protocol. """ import json import requests DEFAULT_ID = -1 DEFAULT_HOST = "http://localhost" DEFAULT_PORT = 6800 JSONRPC_PARSER_ERROR = -32700 JSONRPC_INVALID_REQUEST = -32600 JSONRPC_METHOD_NOT_FOUND = -32601 JSONRPC_INVALID_PARAMS = -32602 JSONRPC_INTERNAL_ERROR = -32603 JSONRPC_CODES = { JSONRPC_PARSER_ERROR: "Invalid JSON was received by the server.", JSONRPC_INVALID_REQUEST: "The JSON sent is not a valid Request object.", JSONRPC_METHOD_NOT_FOUND: "The method does not exist / is not available.", JSONRPC_INVALID_PARAMS: "Invalid method parameter(s).", JSONRPC_INTERNAL_ERROR: "Internal JSON-RPC error.", } class JSONRPCError(Exception): """An exception specific to JSON-RPC errors.""" def __init__(self, code, message): if code in JSONRPC_CODES: message = f"{JSONRPC_CODES[code]}\n{message}" self.code = code self.message = message class JSONRPCClient: """ The JSON-RPC client class. In this documentation, all the following terms refer to the same entity, the remote aria2c process: remote process, remote server, server, daemon process, background process, remote. This class implements method to communicate with a daemon aria2c process through the JSON-RPC protocol. Each method offered by the aria2c process is implemented in this class, in snake_case instead of camelCase (example: add_uri instead of addUri). The class defines a ``METHODS`` variable which contains the names of the available methods. The class is instantiated using an address and port, and optionally a secret token. The token is never passed as a method argument. The class provides utility methods: - call, which performs a JSON-RPC call for a single method; - batch_call, which performs a JSON-RPC call for a list of methods; - multicall2, which is an equivalent of multicall, but easier to use; - post, which is responsible for actually sending a payload to the remote process using a POST request; - get_payload, which is used to build payloads; - get_params, which is used to build list of parameters. """ ADD_URI = "aria2.addUri" ADD_TORRENT = "aria2.addTorrent" ADD_METALINK = "aria2.addMetalink" REMOVE = "aria2.remove" FORCE_REMOVE = "aria2.forceRemove" PAUSE = "aria2.pause" PAUSE_ALL = "aria2.pauseAll" FORCE_PAUSE = "aria2.forcePause" FORCE_PAUSE_ALL = "aria2.forcePauseAll" UNPAUSE = "aria2.unpause" UNPAUSE_ALL = "aria2.unpauseAll" TELL_STATUS = "aria2.tellStatus" GET_URIS = "aria2.getUris" GET_FILES = "aria2.getFiles" GET_PEERS = "aria2.getPeers" GET_SERVERS = "aria2.getServers" TELL_ACTIVE = "aria2.tellActive" TELL_WAITING = "aria2.tellWaiting" TELL_STOPPED = "aria2.tellStopped" CHANGE_POSITION = "aria2.changePosition" CHANGE_URI = "aria2.changeUri" GET_OPTION = "aria2.getOption" CHANGE_OPTION = "aria2.changeOption" GET_GLOBAL_OPTION = "aria2.getGlobalOption" CHANGE_GLOBAL_OPTION = "aria2.changeGlobalOption" GET_GLOBAL_STAT = "aria2.getGlobalStat" PURGE_DOWNLOAD_RESULT = "aria2.purgeDownloadResult" REMOVE_DOWNLOAD_RESULT = "aria2.removeDownloadResult" GET_VERSION = "aria2.getVersion" GET_SESSION_INFO = "aria2.getSessionInfo" SHUTDOWN = "aria2.shutdown" FORCE_SHUTDOWN = "aria2.forceShutdown" SAVE_SESSION = "aria2.saveSession" MULTICALL = "system.multicall" LIST_METHODS = "system.listMethods" LIST_NOTIFICATIONS = "system.listNotifications" METHODS = [ ADD_URI, ADD_TORRENT, ADD_METALINK, REMOVE, FORCE_REMOVE, PAUSE, PAUSE_ALL, FORCE_PAUSE, FORCE_PAUSE_ALL, UNPAUSE, UNPAUSE_ALL, TELL_STATUS, GET_URIS, GET_FILES, GET_PEERS, GET_SERVERS, TELL_ACTIVE, TELL_WAITING, TELL_STOPPED, CHANGE_POSITION, CHANGE_URI, GET_OPTION, CHANGE_OPTION, GET_GLOBAL_OPTION, CHANGE_GLOBAL_OPTION, GET_GLOBAL_STAT, PURGE_DOWNLOAD_RESULT, REMOVE_DOWNLOAD_RESULT, GET_VERSION, GET_SESSION_INFO, SHUTDOWN, FORCE_SHUTDOWN, SAVE_SESSION, MULTICALL, LIST_METHODS, LIST_NOTIFICATIONS, ] def __init__(self, host=DEFAULT_HOST, port=DEFAULT_PORT, secret=""): """ Initialization method. Args: host (str): the remote process address. port (int): the remote process port. secret (str): the secret token. """ host = host.rstrip("/") self.host = host self.port = port self.secret = secret def __str__(self): return self.server @property def server(self): """Property to return the full remote process / server address.""" return f"{self.host}:{self.port}/jsonrpc" # utils def call(self, method, params=None, msg_id=None, insert_secret=True): """ Call a single JSON-RPC method. Args: method (str): the method name. You can use the constant defined in :class:`client.JSONRPCClient`. params (list of str): a list of parameters, as strings. msg_id (int/str): the ID of the call, sent back with the server's answer. insert_secret (bool): whether to insert the secret token in the parameters or not. Returns: The answer from the server, as a Python object (dict / list / str / int). """ params = self.get_params(*(params or [])) if insert_secret and self.secret: if method.startswith("aria2."): params.insert(0, self.secret) elif method == self.MULTICALL: for param in params[0]: param["params"].insert(0, self.secret) return self.post(self.get_payload(method, params, msg_id=msg_id)) def batch_call(self, calls, insert_secret=True): """ Call multiple methods in one request. A batch call is simply a list of full payloads, sent at once to the remote process. The differences with a multicall are: - multicall is defined in the JSON-RPC protocol specification, whereas batch_call is not - multicall is a special "system" method, whereas batch_call is simply the concatenation of several methods - multicall payloads define the "jsonrpc" and "id" keys only once, whereas these keys are repeated in each part of the batch_call method Args: calls (list): a list of tuples composed of method name, parameters and ID. insert_secret (bool): whether to insert the secret token in the parameters or not. Returns: The answer from the server, as a Python object (dict / list / str / int). """ payloads = [] for method, params, msg_id in calls: params = self.get_params(*params) if insert_secret and self.secret and method.startswith("aria2."): params.insert(0, self.secret) payloads.append(self.get_payload(method, params, msg_id, as_json=False)) payload = json.dumps(payloads) return self.post(payload) def multicall2(self, calls, insert_secret=True): """ An method equivalent to multicall, but with a simplified usage. Instead of providing dictionaries with "methodName" and "params" keys and values, this method allows you to provide the values only, in tuples of length 2. With a classic multicall, you would write your params like: [ {"methodName": client.REMOVE, "params": ["2089b05ecca3d829"]}, {"methodName": client.REMOVE, "params": ["2fa07b6e85c40205"]}, ] With multicall2, you can reduce the verbosity: [ (client.REMOVE, ["2089b05ecca3d829"]), (client.REMOVE, ["2fa07b6e85c40205"]), ] Note: multicall2 is not part of the JSON-RPC protocol specification. It is implemented here as a simple convenience method. Args: calls (list): list of tuples composed of method name and parameters. insert_secret (bool): whether to insert the secret token in the parameters or not. Returns: The answer from the server, as a Python object (dict / list / str / int). """ multicall_params = [] for method, params in calls: params = self.get_params(*params) if insert_secret and self.secret and method.startswith("aria2."): params.insert(0, self.secret) multicall_params.append({"methodName": method, "params": params}) payload = self.get_payload(self.MULTICALL, multicall_params) return self.post(payload) def post(self, payload): """ Send a POST request to the server. The response is a JSON string, which we then load as a Python object. Args: payload (dict): the payload / data to send to the remote process. It contains the following key-value pairs: "jsonrpc": "2.0", "method": method, "id": id, "params": params (optional). Returns: The answer from the server, as a Python object (dict / list / str / int). Raises: JSONRPCError: when the server returns an error (client/server error). See the :class:`client.JSONRPCError` class. """ response = requests.post(self.server, data=payload).json() if "result" in response: return response["result"] raise JSONRPCError(response["error"]["code"], response["error"]["message"]) @staticmethod def get_payload(method, params=None, msg_id=None, as_json=True): """ Build a payload. Args: method (str): the method name. You can use the constant defined in :class:`client.JSONRPCClient`. params (list): the list of parameters. msg_id (int/str): the ID of the call, sent back with the server's answer. as_json (bool): whether to return the payload as a JSON-string or Python dictionary. Returns: """ payload = {"jsonrpc": "2.0", "method": method} if msg_id is not None: payload["id"] = msg_id else: payload["id"] = DEFAULT_ID if params: payload["params"] = params return json.dumps(payload) if as_json else payload @staticmethod def get_params(*args): """ Build the list of parameters. This method simply removes the ``None`̀` values from the given arguments. Args: *args: list of parameters. Returns: A new list, with ``None``s filtered out. """ return [p for p in args if p is not None] # aria2 def add_uri(self, uris, options=None, position=None): """ aria2.addUri([secret], uris[, options[, position]]) This method adds a new download. uris is an array of HTTP/FTP/SFTP/BitTorrent URIs (strings) pointing to the same resource. If you mix URIs pointing to different resources, then the download may fail or be corrupted without aria2 complaining. When adding BitTorrent Magnet URIs, uris must have only one element and it should be BitTorrent Magnet URI. options is a struct and its members are pairs of option name and value. See Options below for more details. If position is given, it must be an integer starting from 0. The new download will be inserted at position in the waiting queue. If position is omitted or position is larger than the current size of the queue, the new download is appended to the end of the queue. This method returns the GID of the newly registered download. JSON-RPC Example The following example adds http://example.org/file: >>> 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() '{"id":"qwer","jsonrpc":"2.0","result":"2089b05ecca3d829"}' XML-RPC Example The following example adds http://example.org/file: >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.addUri(['http://example.org/file']) '2089b05ecca3d829' The following example adds a new download with two sources and some options: >>> s.aria2.addUri(['http://example.org/file', 'http://mirror/file'], dict(dir="/tmp")) 'd2703803b52216d1' The following example adds a download and inserts it to the front of the queue: >>> s.aria2.addUri(['http://example.org/file'], {}, 0) 'ca3d829cee549a4d' """ return self.call(self.ADD_URI, params=[uris, options, position]) def add_torrent(self, torrent, uris, options=None, position=None): """ aria2.addTorrent([secret], torrent[, uris[, options[, position]]]) This method adds a BitTorrent download by uploading a ".torrent" file. If you want to add a BitTorrent Magnet URI, use the aria2.addUri() method instead. torrent must be a base64-encoded string containing the contents of the ".torrent" file. uris is an array of URIs (string). uris is used for Web-seeding. For single file torrents, the URI can be a complete URI pointing to the resource; if URI ends with /, name in torrent file is added. For multi-file torrents, name and path in torrent are added to form a URI for each file. options is a struct and its members are pairs of option name and value. See Options below for more details. If position is given, it must be an integer starting from 0. The new download will be inserted at position in the waiting queue. If position is omitted or position is larger than the current size of the queue, the new download is appended to the end of the queue. This method returns the GID of the newly registered download. If --rpc-save-upload-metadata is true, the uploaded data is saved as a file named as the hex string of SHA-1 hash of data plus ".torrent" in the directory specified by --dir option. E.g. a file name might be 0a3893293e27ac0490424c06de4d09242215f0a6.torrent. If a file with the same name already exists, it is overwritten! If the file cannot be saved successfully or --rpc-save-upload-metadata is false, the downloads added by this method are not saved by --save-session. The following examples add local file file.torrent. JSON-RPC Example >>> import urllib2, json, base64 >>> torrent = base64.b64encode(open('file.torrent').read()) >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'asdf', ... 'method':'aria2.addTorrent', 'params':[torrent]}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> c.read() '{"id":"asdf","jsonrpc":"2.0","result":"2089b05ecca3d829"}' XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.addTorrent(xmlrpclib.Binary(open('file.torrent', mode='rb').read())) '2089b05ecca3d829' """ return self.call(self.ADD_TORRENT, [torrent, uris, options, position]) def add_metalink(self, metalink, options=None, position=None): """ aria2.addMetalink([secret], metalink[, options[, position]]) This method adds a Metalink download by uploading a ".metalink" file. metalink is a base64-encoded string which contains the contents of the ".metalink" file. options is a struct and its members are pairs of option name and value. See Options below for more details. If position is given, it must be an integer starting from 0. The new download will be inserted at position in the waiting queue. If position is omitted or position is larger than the current size of the queue, the new download is appended to the end of the queue. This method returns an array of GIDs of newly registered downloads. If --rpc-save-upload-metadata is true, the uploaded data is saved as a file named hex string of SHA-1 hash of data plus ".metalink" in the directory specified by --dir option. E.g. a file name might be 0a3893293e27ac0490424c06de4d09242215f0a6.metalink. If a file with the same name already exists, it is overwritten! If the file cannot be saved successfully or --rpc-save-upload-metadata is false, the downloads added by this method are not saved by --save-session. The following examples add local file file.meta4. JSON-RPC Example >>> import urllib2, json, base64 >>> metalink = base64.b64encode(open('file.meta4').read()) >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.addMetalink', ... 'params':[metalink]}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> c.read() '{"id":"qwer","jsonrpc":"2.0","result":["2089b05ecca3d829"]}' XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.addMetalink(xmlrpclib.Binary(open('file.meta4', mode='rb').read())) ['2089b05ecca3d829'] """ return self.call(self.ADD_METALINK, [metalink, options, position]) def remove(self, gid): """ aria2.remove([secret], gid) This method removes the download denoted by gid (string). If the specified download is in progress, it is first stopped. The status of the removed download becomes removed. This method returns GID of removed download. The following examples remove a download with GID#2089b05ecca3d829. JSON-RPC Example >>> import urllib2, json >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.remove', ... 'params':['2089b05ecca3d829']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> c.read() '{"id":"qwer","jsonrpc":"2.0","result":"2089b05ecca3d829"}' XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.remove('2089b05ecca3d829') '2089b05ecca3d829' """ return self.call(self.REMOVE, [gid]) def force_remove(self, gid): """ aria2.forceRemove([secret], gid) This method removes the download denoted by gid. This method behaves just like aria2.remove() except that this method removes the download without performing any actions which take time, such as contacting BitTorrent trackers to unregister the download first. """ return self.call(self.FORCE_REMOVE, [gid]) def pause(self, gid): """ aria2.pause([secret], gid) This method pauses the download denoted by gid (string). The status of paused download becomes paused. If the download was active, the download is placed in the front of waiting queue. While the status is paused, the download is not started. To change status to waiting, use the aria2.unpause() method. This method returns GID of paused download. """ return self.call(self.PAUSE, [gid]) def pause_all(self): """ aria2.pauseAll([secret]) This method is equal to calling aria2.pause() for every active/waiting download. This methods returns OK. """ return self.call(self.PAUSE_ALL) def force_pause(self, gid): """ aria2.forcePause([secret], gid) This method pauses the download denoted by gid. This method behaves just like aria2.pause() except that this method pauses downloads without performing any actions which take time, such as contacting BitTorrent trackers to unregister the download first. """ return self.call(self.FORCE_PAUSE, [gid]) def force_pause_all(self): """ aria2.forcePauseAll([secret]) This method is equal to calling aria2.forcePause() for every active/waiting download. This methods returns OK. """ return self.call(self.FORCE_PAUSE_ALL) def unpause(self, gid): """ aria2.unpause([secret], gid) This method changes the status of the download denoted by gid (string) from paused to waiting, making the download eligible to be restarted. This method returns the GID of the unpaused download. """ return self.call(self.UNPAUSE, [gid]) def unpause_all(self): """ aria2.unpauseAll([secret]) This method is equal to calling aria2.unpause() for every active/waiting download. This methods returns OK. """ return self.call(self.UNPAUSE_ALL) def tell_status(self, gid, keys=None): """ aria2.tellStatus([secret], gid[, keys]) This method returns the progress of the download denoted by gid (string). keys is an array of strings. If specified, the response contains only keys in the keys array. If keys is empty or omitted, the response contains all keys. This is useful when you just want specific keys and avoid unnecessary transfers. For example, aria2.tellStatus("2089b05ecca3d829", ["gid", "status"]) returns the gid and status keys only. The response is a struct and contains following keys. Values are strings. gid GID of the download. status active for currently downloading/seeding downloads. waiting for downloads in the queue; download is not started. paused for paused downloads. error for downloads that were stopped because of error. complete for stopped and completed downloads. removed for the downloads removed by user. totalLength Total length of the download in bytes. completedLength Completed length of the download in bytes. uploadLength Uploaded length of the download in bytes. bitfield Hexadecimal representation of the download progress. The highest bit corresponds to the piece at index 0. Any set bits indicate loaded pieces, while unset bits indicate not yet loaded and/or missing pieces. Any overflow bits at the end are set to zero. When the download was not started yet, this key will not be included in the response. downloadSpeed Download speed of this download measured in bytes/sec. uploadSpeed Upload speed of this download measured in bytes/sec. infoHash InfoHash. BitTorrent only. numSeeders The number of seeders aria2 has connected to. BitTorrent only. seeder true if the local endpoint is a seeder. Otherwise false. BitTorrent only. pieceLength Piece length in bytes. numPieces The number of pieces. connections The number of peers/servers aria2 has connected to. errorCode The code of the last error for this item, if any. The value is a string. The error codes are defined in the EXIT STATUS section. This value is only available for stopped/completed downloads. errorMessage The (hopefully) human readable error message associated to errorCode. followedBy List of GIDs which are generated as the result of this download. For example, when aria2 downloads a Metalink file, it generates downloads described in the Metalink (see the --follow-metalink option). This value is useful to track auto-generated downloads. If there are no such downloads, this key will not be included in the response. following The reverse link for followedBy. A download included in followedBy has this object's GID in its following value. belongsTo GID of a parent download. Some downloads are a part of another download. For example, if a file in a Metalink has BitTorrent resources, the downloads of ".torrent" files are parts of that parent. If this download has no parent, this key will not be included in the response. dir Directory to save files. files Return the list of files. The elements of this list are the same structs used in aria2.getFiles() method. bittorrent Struct which contains information retrieved from the .torrent (file). BitTorrent only. It contains following keys. announceList List of lists of announce URIs. If the torrent contains announce and no announce-list, announce is converted to the announce-list format. comment The comment of the torrent. comment.utf-8 is used if available. creationDate The creation time of the torrent. The value is an integer since the epoch, measured in seconds. mode File mode of the torrent. The value is either single or multi. info Struct which contains data from Info dictionary. It contains following keys. name name in info dictionary. name.utf-8 is used if available. verifiedLength The number of verified number of bytes while the files are being hash checked. This key exists only when this download is being hash checked. verifyIntegrityPending true if this download is waiting for the hash check in a queue. This key exists only when this download is in the queue. JSON-RPC Example The following example gets information about a download with GID#2089b05ecca3d829: >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.tellStatus', ... 'params':['2089b05ecca3d829']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': {u'bitfield': u'0000000000', u'completedLength': u'901120', u'connections': u'1', u'dir': u'/downloads', u'downloadSpeed': u'15158', u'files': [{u'index': u'1', u'length': u'34896138', u'completedLength': u'34896138', u'path': u'/downloads/file', u'selected': u'true', u'uris': [{u'status': u'used', u'uri': u'http://example.org/file'}]}], u'gid': u'2089b05ecca3d829', u'numPieces': u'34', u'pieceLength': u'1048576', u'status': u'active', u'totalLength': u'34896138', u'uploadLength': u'0', u'uploadSpeed': u'0'}} The following example gets only specific keys: >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.tellStatus', ... 'params':['2089b05ecca3d829', ... ['gid', ... 'totalLength', ... 'completedLength']]}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': {u'completedLength': u'5701632', u'gid': u'2089b05ecca3d829', u'totalLength': u'34896138'}} XML-RPC Example The following example gets information about a download with GID#2089b05ecca3d829: >>> import xmlrpclib >>> from pprint import pprint >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> r = s.aria2.tellStatus('2089b05ecca3d829') >>> pprint(r) {'bitfield': 'ffff80', 'completedLength': '34896138', 'connections': '0', 'dir': '/downloads', 'downloadSpeed': '0', 'errorCode': '0', 'files': [{'index': '1', 'length': '34896138', 'completedLength': '34896138', 'path': '/downloads/file', 'selected': 'true', 'uris': [{'status': 'used', 'uri': 'http://example.org/file'}]}], 'gid': '2089b05ecca3d829', 'numPieces': '17', 'pieceLength': '2097152', 'status': 'complete', 'totalLength': '34896138', 'uploadLength': '0', 'uploadSpeed': '0'} The following example gets only specific keys: >>> r = s.aria2.tellStatus('2089b05ecca3d829', ['gid', 'totalLength', 'completedLength']) >>> pprint(r) {'completedLength': '34896138', 'gid': '2089b05ecca3d829', 'totalLength': '34896138'} """ return self.call(self.TELL_STATUS, [gid, keys]) def get_uris(self, gid): """ aria2.getUris([secret], gid) This method returns the URIs used in the download denoted by gid (string). The response is an array of structs and it contains following keys. Values are string. uri URI status 'used' if the URI is in use. 'waiting' if the URI is still waiting in the queue. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.getUris', ... 'params':['2089b05ecca3d829']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [{u'status': u'used', u'uri': u'http://example.org/file'}]} XML-RPC Example >>> import xmlrpclib >>> from pprint import pprint >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> r = s.aria2.getUris('2089b05ecca3d829') >>> pprint(r) [{'status': 'used', 'uri': 'http://example.org/file'}] """ return self.call(self.GET_URIS, [gid]) def get_files(self, gid): """ aria2.getFiles([secret], gid) This method returns the file list of the download denoted by gid (string). The response is an array of structs which contain following keys. Values are strings. index Index of the file, starting at 1, in the same order as files appear in the multi-file torrent. path File path. length File size in bytes. completedLength Completed length of this file in bytes. Please note that it is possible that sum of completedLength is less than the completedLength returned by the aria2.tellStatus() method. This is because completedLength in aria2.getFiles() only includes completed pieces. On the other hand, completedLength in aria2.tellStatus() also includes partially completed pieces. selected true if this file is selected by --select-file option. If --select-file is not specified or this is single-file torrent or not a torrent download at all, this value is always true. Otherwise false. uris Returns a list of URIs for this file. The element type is the same struct used in the aria2.getUris() method. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.getFiles', ... 'params':['2089b05ecca3d829']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [{u'index': u'1', u'length': u'34896138', u'completedLength': u'34896138', u'path': u'/downloads/file', u'selected': u'true', u'uris': [{u'status': u'used', u'uri': u'http://example.org/file'}]}]} XML-RPC Example >>> import xmlrpclib >>> from pprint import pprint >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> r = s.aria2.getFiles('2089b05ecca3d829') >>> pprint(r) [{'index': '1', 'length': '34896138', 'completedLength': '34896138', 'path': '/downloads/file', 'selected': 'true', 'uris': [{'status': 'used', 'uri': 'http://example.org/file'}]}] """ return self.call(self.GET_FILES, [gid]) def get_peers(self, gid): """ aria2.getPeers([secret], gid) This method returns a list peers of the download denoted by gid (string). This method is for BitTorrent only. The response is an array of structs and contains the following keys. Values are strings. peerId Percent-encoded peer ID. ip IP address of the peer. port Port number of the peer. bitfield Hexadecimal representation of the download progress of the peer. The highest bit corresponds to the piece at index 0. Set bits indicate the piece is available and unset bits indicate the piece is missing. Any spare bits at the end are set to zero. amChoking true if aria2 is choking the peer. Otherwise false. peerChoking true if the peer is choking aria2. Otherwise false. downloadSpeed Download speed (byte/sec) that this client obtains from the peer. uploadSpeed Upload speed(byte/sec) that this client uploads to the peer. seeder true if this peer is a seeder. Otherwise false. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.getPeers', ... 'params':['2089b05ecca3d829']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [{u'amChoking': u'true', u'bitfield': u'ffffffffffffffffffffffffffffffffffffffff', u'downloadSpeed': u'10602', u'ip': u'10.0.0.9', u'peerChoking': u'false', u'peerId': u'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6', u'port': u'6881', u'seeder': u'true', u'uploadSpeed': u'0'}, {u'amChoking': u'false', u'bitfield': u'ffffeff0fffffffbfffffff9fffffcfff7f4ffff', u'downloadSpeed': u'8654', u'ip': u'10.0.0.30', u'peerChoking': u'false', u'peerId': u'bittorrent client758', u'port': u'37842', u'seeder': u'false', u'uploadSpeed': u'6890'}]} XML-RPC Example >>> import xmlrpclib >>> from pprint import pprint >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> r = s.aria2.getPeers('2089b05ecca3d829') >>> pprint(r) [{'amChoking': 'true', 'bitfield': 'ffffffffffffffffffffffffffffffffffffffff', 'downloadSpeed': '10602', 'ip': '10.0.0.9', 'peerChoking': 'false', 'peerId': 'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6', 'port': '6881', 'seeder': 'true', 'uploadSpeed': '0'}, {'amChoking': 'false', 'bitfield': 'ffffeff0fffffffbfffffff9fffffcfff7f4ffff', 'downloadSpeed': '8654', 'ip': '10.0.0.30', 'peerChoking': 'false', 'peerId': 'bittorrent client758', 'port': '37842', 'seeder': 'false, 'uploadSpeed': '6890'}] """ return self.call(self.GET_PEERS, [gid]) def get_servers(self, gid): """ aria2.getServers([secret], gid) This method returns currently connected HTTP(S)/FTP/SFTP servers of the download denoted by gid (string). The response is an array of structs and contains the following keys. Values are strings. index Index of the file, starting at 1, in the same order as files appear in the multi-file metalink. servers A list of structs which contain the following keys. uri Original URI. currentUri This is the URI currently used for downloading. If redirection is involved, currentUri and uri may differ. downloadSpeed Download speed (byte/sec) JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.getServers', ... 'params':['2089b05ecca3d829']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [{u'index': u'1', u'servers': [{u'currentUri': u'http://example.org/file', u'downloadSpeed': u'10467', u'uri': u'http://example.org/file'}]}]} XML-RPC Example >>> import xmlrpclib >>> from pprint import pprint >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> r = s.aria2.getServers('2089b05ecca3d829') >>> pprint(r) [{'index': '1', 'servers': [{'currentUri': 'http://example.org/dl/file', 'downloadSpeed': '20285', 'uri': 'http://example.org/file'}]}] """ return self.call(self.GET_SERVERS, [gid]) def tell_active(self, keys=None): """ aria2.tellActive([secret][, keys]) This method returns a list of active downloads. The response is an array of the same structs as returned by the aria2.tellStatus() method. For the keys parameter, please refer to the aria2.tellStatus() method. """ return self.call(self.TELL_ACTIVE, [keys]) def tell_waiting(self, offset, num, keys=None): """ aria2.tellWaiting([secret], offset, num[, keys]) This method returns a list of waiting downloads, including paused ones. offset is an integer and specifies the offset from the download waiting at the front. num is an integer and specifies the max. number of downloads to be returned. For the keys parameter, please refer to the aria2.tellStatus() method. If offset is a positive integer, this method returns downloads in the range of [offset, offset + num). offset can be a negative integer. offset == -1 points last download in the waiting queue and offset == -2 points the download before the last download, and so on. Downloads in the response are in reversed order then. For example, imagine three downloads "A","B" and "C" are waiting in this order. aria2.tellWaiting(0, 1) returns ["A"]. aria2.tellWaiting(1, 2) returns ["B", "C"]. aria2.tellWaiting(-1, 2) returns ["C", "B"]. The response is an array of the same structs as returned by aria2.tellStatus() method. """ return self.call(self.TELL_WAITING, [offset, num, keys]) def tell_stopped(self, offset, num, keys=None): """ aria2.tellStopped([secret], offset, num[, keys]) This method returns a list of stopped downloads. offset is an integer and specifies the offset from the least recently stopped download. num is an integer and specifies the max. number of downloads to be returned. For the keys parameter, please refer to the aria2.tellStatus() method. offset and num have the same semantics as described in the aria2.tellWaiting() method. The response is an array of the same structs as returned by the aria2.tellStatus() method. """ return self.call(self.TELL_STOPPED, [offset, num, keys]) def change_position(self, gid, pos, how): """ aria2.changePosition([secret], gid, pos, how) This method changes the position of the download denoted by gid in the queue. pos is an integer. how is a string. If how is POS_SET, it moves the download to a position relative to the beginning of the queue. If how is POS_CUR, it moves the download to a position relative to the current position. If how is POS_END, it moves the download to a position relative to the end of the queue. If the destination position is less than 0 or beyond the end of the queue, it moves the download to the beginning or the end of the queue respectively. The response is an integer denoting the resulting position. For example, if GID#2089b05ecca3d829 is currently in position 3, aria2.changePosition('2089b05ecca3d829', -1, 'POS_CUR') will change its position to 2. Additionally aria2.changePosition('2089b05ecca3d829', 0, 'POS_SET') will change its position to 0 (the beginning of the queue). The following examples move the download GID#2089b05ecca3d829 to the front of the queue. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.changePosition', ... 'params':['2089b05ecca3d829', 0, 'POS_SET']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': 0} XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.changePosition('2089b05ecca3d829', 0, 'POS_SET') 0 """ return self.call(self.CHANGE_POSITION, [gid, pos, how]) def change_uri(self, gid, file_index, del_uris, add_uris, position=None): """ aria2.changeUri([secret], gid, fileIndex, delUris, addUris[, position]) This method removes the URIs in delUris from and appends the URIs in addUris to download denoted by gid. delUris and addUris are lists of strings. A download can contain multiple files and URIs are attached to each file. fileIndex is used to select which file to remove/attach given URIs. fileIndex is 1-based. position is used to specify where URIs are inserted in the existing waiting URI list. position is 0-based. When position is omitted, URIs are appended to the back of the list. This method first executes the removal and then the addition. position is the position after URIs are removed, not the position when this method is called. When removing an URI, if the same URIs exist in download, only one of them is removed for each URI in delUris. In other words, if there are three URIs http://example.org/aria2 and you want remove them all, you have to specify (at least) 3 http://example.org/aria2 in delUris. This method returns a list which contains two integers. The first integer is the number of URIs deleted. The second integer is the number of URIs added. The following examples add the URI http://example.org/file to the file whose index is 1 and belongs to the download GID#2089b05ecca3d829. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.changeUri', ... 'params':['2089b05ecca3d829', 1, [], ['http://example.org/file']]}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [0, 1]} XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.changeUri('2089b05ecca3d829', 1, [], ['http://example.org/file']) [0, 1] """ return self.call(self.CHANGE_URI, [gid, file_index, del_uris, add_uris, position]) def get_option(self, gid): """ aria2.getOption([secret], gid) This method returns options of the download denoted by gid. The response is a struct where keys are the names of options. The values are strings. Note that this method does not return options which have no default value and have not been set on the command-line, in configuration files or RPC methods. The following examples get options of the download GID#2089b05ecca3d829. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.getOption', ... 'params':['2089b05ecca3d829']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': {u'allow-overwrite': u'false', u'allow-piece-length-change': u'false', u'always-resume': u'true', u'async-dns': u'true', ... XML-RPC Example >>> import xmlrpclib >>> from pprint import pprint >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> r = s.aria2.getOption('2089b05ecca3d829') >>> pprint(r) {'allow-overwrite': 'false', 'allow-piece-length-change': 'false', 'always-resume': 'true', 'async-dns': 'true', .... """ return self.call(self.GET_OPTION, [gid]) def change_option(self, gid, options): """ aria2.changeOption([secret], gid, options) This method changes options of the download denoted by gid (string) dynamically. options is a struct. The options listed in Input File subsection are available, except for following options: · dry-run · metalink-base-uri · parameterized-uri · pause · piece-length · rpc-save-upload-metadata Except for the following options, changing the other options of active download makes it restart (restart itself is managed by aria2, and no user intervention is required): · bt-max-peers · bt-request-peer-speed-limit · bt-remove-unselected-file · force-save · max-download-limit · max-upload-limit This method returns OK for success. The following examples set the max-download-limit option to 20K for the download GID#2089b05ecca3d829. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.changeOption', ... 'params':['2089b05ecca3d829', ... {'max-download-limit':'10K'}]}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'} XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.changeOption('2089b05ecca3d829', {'max-download-limit':'20K'}) 'OK' """ return self.call(self.CHANGE_OPTION, [gid, options]) def get_global_option(self): """ aria2.getGlobalOption([secret]) This method returns the global options. The response is a struct. Its keys are the names of options. Values are strings. Note that this method does not return options which have no default value and have not been set on the command-line, in configuration files or RPC methods. Because global options are used as a template for the options of newly added downloads, the response contains keys returned by the aria2.getOption() method. """ return self.call(self.GET_GLOBAL_OPTION) def change_global_option(self, options): """ aria2.changeGlobalOption([secret], options) This method changes global options dynamically. options is a struct. The following options are available: · bt-max-open-files · download-result · keep-unfinished-download-result · log · log-level · max-concurrent-downloads · max-download-result · max-overall-download-limit · max-overall-upload-limit · optimize-concurrent-downloads · save-cookies · save-session · server-stat-of In addition, options listed in the Input File subsection are available, except for following options: checksum, index-out, out, pause and select-file. With the log option, you can dynamically start logging or change log file. To stop logging, specify an empty string("") as the parameter value. Note that log file is always opened in append mode. This method returns OK for success. """ return self.call(self.CHANGE_GLOBAL_OPTION, [options]) def get_global_stat(self): """ aria2.getGlobalStat([secret]) This method returns global statistics such as the overall download and upload speeds. The response is a struct and contains the following keys. Values are strings. downloadSpeed Overall download speed (byte/sec). uploadSpeed Overall upload speed(byte/sec). numActive The number of active downloads. numWaiting The number of waiting downloads. numStopped The number of stopped downloads in the current session. This value is capped by the --max-download-result option. numStoppedTotal The number of stopped downloads in the current session and not capped by the --max-download-result option. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.getGlobalStat'}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': {u'downloadSpeed': u'21846', u'numActive': u'2', u'numStopped': u'0', u'numWaiting': u'0', u'uploadSpeed': u'0'}} XML-RPC Example >>> import xmlrpclib >>> from pprint import pprint >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> r = s.aria2.getGlobalStat() >>> pprint(r) {'downloadSpeed': '23136', 'numActive': '2', 'numStopped': '0', 'numWaiting': '0', 'uploadSpeed': '0'} """ return self.call(self.GET_GLOBAL_STAT) def purge_download_result(self): """ aria2.purgeDownloadResult([secret]) This method purges completed/error/removed downloads to free memory. This method returns OK. """ return self.call(self.PURGE_DOWNLOAD_RESULT) def remove_download_result(self, gid): """ aria2.removeDownloadResult([secret], gid) This method removes a completed/error/removed download denoted by gid from memory. This method returns OK for success. The following examples remove the download result of the download GID#2089b05ecca3d829. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.removeDownloadResult', ... 'params':['2089b05ecca3d829']}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'} XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.removeDownloadResult('2089b05ecca3d829') 'OK' """ return self.call(self.REMOVE_DOWNLOAD_RESULT, [gid]) def get_version(self): """ aria2.getVersion([secret]) This method returns the version of aria2 and the list of enabled features. The response is a struct and contains following keys. version Version number of aria2 as a string. enabledFeatures List of enabled features. Each feature is given as a string. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.getVersion'}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': {u'enabledFeatures': [u'Async DNS', u'BitTorrent', u'Firefox3 Cookie', u'GZip', u'HTTPS', u'Message Digest', u'Metalink', u'XML-RPC'], u'version': u'1.11.0'}} XML-RPC Example >>> import xmlrpclib >>> from pprint import pprint >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> r = s.aria2.getVersion() >>> pprint(r) {'enabledFeatures': ['Async DNS', 'BitTorrent', 'Firefox3 Cookie', 'GZip', 'HTTPS', 'Message Digest', 'Metalink', 'XML-RPC'], 'version': '1.11.0'} """ return self.call(self.GET_VERSION) def get_session_info(self): """ aria2.getSessionInfo([secret]) This method returns session information. The response is a struct and contains following key. sessionId Session ID, which is generated each time when aria2 is invoked. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.getSessionInfo'}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': {u'sessionId': u'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}} XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.aria2.getSessionInfo() {'sessionId': 'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'} """ return self.call(self.GET_SESSION_INFO) def shutdown(self): """ aria2.shutdown([secret]) This method shuts down aria2. This method returns OK. """ return self.call(self.SHUTDOWN) def force_shutdown(self): """ aria2.forceShutdown([secret]) This method shuts down aria2(). This method behaves like :func:'aria2.shutdown` without performing any actions which take time, such as contacting BitTorrent trackers to unregister downloads first. This method returns OK. """ return self.call(self.FORCE_SHUTDOWN) def save_session(self): """ aria2.saveSession([secret]) This method saves the current session to a file specified by the --save-session option. This method returns OK if it succeeds. """ return self.call(self.SAVE_SESSION) # system def multicall(self, methods): """ system.multicall(methods) This methods encapsulates multiple method calls in a single request. methods is an array of structs. The structs contain two keys: methodName and params. methodName is the method name to call and params is array containing parameters to the method call. This method returns an array of responses. The elements will be either a one-item array containing the return value of the method call or a struct of fault element if an encapsulated method call fails. In the following examples, we add 2 downloads. The first one is http://example.org/file and the second one is file.torrent. JSON-RPC Example >>> import urllib2, json, base64 >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'system.multicall', ... 'params':[[{'methodName':'aria2.addUri', ... 'params':[['http://example.org']]}, ... {'methodName':'aria2.addTorrent', ... 'params':[base64.b64encode(open('file.torrent').read())]}]]}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [[u'2089b05ecca3d829'], [u'd2703803b52216d1']]} JSON-RPC additionally supports Batch requests as described in the JSON-RPC 2.0 Specification: >>> jsonreq = json.dumps([{'jsonrpc':'2.0', 'id':'qwer', ... 'method':'aria2.addUri', ... 'params':[['http://example.org']]}, ... {'jsonrpc':'2.0', 'id':'asdf', ... 'method':'aria2.addTorrent', ... 'params':[base64.b64encode(open('file.torrent').read())]}]) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) [{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'2089b05ecca3d829'}, {u'id': u'asdf', u'jsonrpc': u'2.0', u'result': u'd2703803b52216d1'}] XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> mc = xmlrpclib.MultiCall(s) >>> mc.aria2.addUri(['http://example.org/file']) >>> mc.aria2.addTorrent(xmlrpclib.Binary(open('file.torrent', mode='rb').read())) >>> r = mc() >>> tuple(r) ('2089b05ecca3d829', 'd2703803b52216d1') """ return self.call(self.MULTICALL, [methods]) def list_methods(self): """ system.listMethods() This method returns all the available RPC methods in an array of string. Unlike other methods, this method does not require secret token. This is safe because this method just returns the available method names. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'system.listMethods'}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [u'aria2.addUri', u'aria2.addTorrent', ... XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.system.listMethods() ['aria2.addUri', 'aria2.addTorrent', ... """ return self.call(self.LIST_METHODS) def list_notifications(self): """ system.listNotifications() This method returns all the available RPC notifications in an array of string. Unlike other methods, this method does not require secret token. This is safe because this method just returns the available notifications names. JSON-RPC Example >>> import urllib2, json >>> from pprint import pprint >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer', ... 'method':'system.listNotifications'}) >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq) >>> pprint(json.loads(c.read())) {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [u'aria2.onDownloadStart', u'aria2.onDownloadPause', ... XML-RPC Example >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') >>> s.system.listNotifications() ['aria2.onDownloadStart', 'aria2.onDownloadPause', ... """ return self.call(self.LIST_NOTIFICATIONS) PK!]Ob 8 8aria2p/downloads.py""" This module defines the BitTorrent, File and Download classes, which respectively hold structured information about torrent files, files and downloads in aria2c. """ from datetime import timedelta class BitTorrent: """Information retrieved from a .torrent file.""" def __init__(self, struct): """ Initialization method. Args: struct (dict): a dictionary Python object returned by the JSON-RPC client. """ self._struct = struct def __str__(self): return self.info["name"] @property def announce_list(self): """ List of lists of announce URIs. If the torrent contains announce and no announce-list, announce is converted to the announce-list format. """ return self._struct.get("announceList") @property def comment(self): """ The comment of the torrent. comment.utf-8 is used if available. """ return self._struct.get("comment") @property def creation_date(self): """ The creation time of the torrent. The value is an integer since the epoch, measured in seconds. """ return self._struct.get("creationDate") @property def mode(self): """ File mode of the torrent. The value is either single or multi. """ return self._struct.get("mode") @property def info(self): """ Struct which contains data from Info dictionary. It contains following keys: name name in info dictionary. name.utf-8 is used if available. """ return self._struct.get("info") class File: """Information about a download's file.""" def __init__(self, struct): """ Initialization method. Args: struct (dict): a dictionary Python object returned by the JSON-RPC client. """ self._struct = struct def __str__(self): return self.path @property def index(self): """Index of the file, starting at 1, in the same order as files appear in the multi-file torrent.""" return self._struct.get("index") @property def path(self): """File path.""" return self._struct.get("path") @property def length(self): """File size in bytes.""" return self._struct.get("length") @property def completed_length(self): """ Completed length of this file in bytes. Please note that it is possible that sum of completedLength is less than the completedLength returned by the aria2.tellStatus() method. This is because completedLength in aria2.getFiles() only includes completed pieces. On the other hand, completedLength in aria2.tellStatus() also includes partially completed pieces. """ return self._struct.get("completedLength") @property def selected(self): """ True if this file is selected by --select-file option. If --select-file is not specified or this is single-file torrent or not a torrent download at all, this value is always true. Otherwise false. """ return self._struct.get("selected") @property def uris(self): """ Return a list of URIs for this file. The element type is the same struct used in the aria2.getUris() method. """ return self._struct.get("uris") class Download: """Class containing all information about a download, as retrieved with the client.""" def __init__(self, api, struct): """ Initialization method. Args: api (:class:`api.API`): the reference to an :class:`api.API` instance. struct (dict): a dictionary Python object returned by the JSON-RPC client. """ self.api = api self._struct = struct self._files = [] self._bittorrent = None self._name = "" self._options = None def __str__(self): return self.name @staticmethod def _human_readable_bytes(value, digits=2, delim="", postfix=""): unit = 'B' for u in ('kiB', 'MiB', "GiB", "TiB", "PiB", "EiB"): if value > 1000: value /= 1024 unit = u else: break return f"{value:.{digits}f}" + delim + unit + postfix def _human_readable_seconds(self): pass def update(self, struct): """ Method to update the internal values of the download with more recent values. Args: struct (dict): a dictionary Python object returned by the JSON-RPC client. """ self._struct.update(struct) def refetch(self): self.update(self.api.get_download(self.gid)) @property def name(self): """ The name of the download. Name is the name of the file if single-file, first file's directory name if multi-file. """ if not self._name: self._name = self.files[0].path.replace(self.dir, "").lstrip("/").split("/")[0] return self._name @property def options(self): """ Options specific to this download. The returned object is an instance of :class:`options.Options`. """ if not self._options: self._options = self.api.get_options(gids=[self.gid]).get(self.gid) return self._options @property def gid(self): """GID of the download.""" return self._struct.get("gid") @property def status(self): """Status of the download: active, waiting, paused, error, complete or removed.""" return self._struct.get("status") @property def total_length(self): """Total length of the download in bytes.""" return int(self._struct.get("totalLength")) def total_length_string(self, human_readable=True): if human_readable: return self._human_readable_bytes(self.total_length, delim=" ") return str(self.total_length) + " B" @property def completed_length(self): """Completed length of the download in bytes.""" return int(self._struct.get("completedLength")) def completed_length_string(self, human_readable=True): if human_readable: return self._human_readable_bytes(self.completed_length, delim=" ") return str(self.completed_length) + " B" @property def upload_length(self): """Uploaded length of the download in bytes.""" return int(self._struct.get("uploadLength")) def upload_length_string(self, human_readable=True): if human_readable: return self._human_readable_bytes(self.upload_length, delim=" ") return str(self.upload_length) + " B" @property def bitfield(self): """ Hexadecimal representation of the download progress. The highest bit corresponds to the piece at index 0. Any set bits indicate loaded pieces, while unset bits indicate not yet loaded and/or missing pieces. Any overflow bits at the end are set to zero. When the download was not started yet, this key will not be included in the response. """ return self._struct.get("bitfield") @property def download_speed(self): """Download speed of this download measured in bytes/sec.""" return int(self._struct.get("downloadSpeed")) def download_speed_string(self, human_readable=True): if human_readable: return self._human_readable_bytes(self.download_speed, delim=" ", postfix="/s") return str(self.download_speed) + " B/s" @property def upload_speed(self): """Upload speed of this download measured in bytes/sec.""" return int(self._struct.get("uploadSpeed")) def upload_speed_string(self, human_readable=True): if human_readable: return self._human_readable_bytes(self.upload_speed, delim=" ", postfix="/s") return str(self.upload_speed) + " B/s" @property def info_hash(self): """ InfoHash. BitTorrent only. """ return self._struct.get("infoHash") @property def num_seeders(self): """ The number of seeders aria2 has connected to. BitTorrent only. """ return int(self._struct.get("numSeeders")) @property def seeder(self): """ True if the local endpoint is a seeder, otherwise false. BitTorrent only. """ return self._struct.get("seeder ") @property def piece_length(self): """Piece length in bytes.""" return int(self._struct.get("pieceLength")) def piece_length_string(self, human_readable=True): if human_readable: return self._human_readable_bytes(self.piece_length, delim=" ") return str(self.piece_length) + " B" @property def num_pieces(self): """The number of pieces.""" return int(self._struct.get("numPieces")) @property def connections(self): """The number of peers/servers aria2 has connected to.""" return int(self._struct.get("connections")) @property def error_code(self): """ The code of the last error for this item, if any. The value is a string. The error codes are defined in the EXIT STATUS section. This value is only available for stopped/completed downloads. """ return self._struct.get("errorCode") @property def error_message(self): """The (hopefully) human readable error message associated to errorCode.""" return self._struct.get("errorMessage") @property def followed_by_ids(self): """ List of GIDs which are generated as the result of this download. For example, when aria2 downloads a Metalink file, it generates downloads described in the Metalink (see the --follow-metalink option). This value is useful to track auto-generated downloads. If there are no such downloads, this key will not be included in the response. """ return self._struct.get("followedBy") @property def followed_by(self): """ List of downloads generated as the result of this download. Returns a list of instances of :class:`downloads.Download`. """ return [self.api.get_download(gid) for gid in self.followed_by_ids] @property def following_id(self): """ The reverse link for followedBy. A download included in followedBy has this object's GID in its following value. """ return self._struct.get("following") @property def following(self): """ The download this download is following. Returns an instance of :class:`downloads.Download`. """ return self.api.get_download(self.following_id) @property def belongs_to_id(self): """ GID of a parent download. Some downloads are a part of another download. For example, if a file in a Metalink has BitTorrent resources, The downloads of ".torrent" files are parts of that parent. If this download has no parent, this key will not be included in the response. """ return self._struct.get("belongsTo") @property def belongs_to(self): """ Parent download. Returns an instance of :class:`downloads.Download`. """ return self.api.get_download(self.belongs_to_id) @property def dir(self): """Directory to save files.""" return self._struct.get("dir") @property def files(self): """ Return the list of files. The elements of this list are the same structs used in aria2.getFiles() method. """ if not self._files: self._files = [File(s) for s in self._struct.get("files")] return self._files @property def bittorrent(self): """ Struct which contains information retrieved from the .torrent (file). BitTorrent only. """ if not self._bittorrent: self._bittorrent = BitTorrent(self._struct.get("bittorrent")) return self._bittorrent @property def verified_length(self): """ The number of verified number of bytes while the files are being hash checked. This key exists only when this download is being hash checked. """ return int(self._struct.get("verifiedLength")) def verified_length_string(self, human_readable=True): if human_readable: return self._human_readable_bytes(self.verified_length, delim=" ") return str(self.verified_length) + " B" @property def verify_integrity_pending(self): """ True if this download is waiting for the hash check in a queue. This key exists only when this download is in the queue. """ return self._struct.get("verifyIntegrityPending") @property def progress(self): """Return the progress of the download as float.""" try: return self.completed_length / self.total_length * 100 except ZeroDivisionError: return 0.0 def progress_string(self, digits=2): return f"{self.progress:.{digits}f}%" @property def eta(self): try: return timedelta(seconds=int((self.total_length - self.completed_length) / self.download_speed)) except ZeroDivisionError: return float('Inf') def eta_string(self): eta = self.eta if eta == float("Inf"): return "-" pieces = [] if eta.days: pieces.append(f"{eta.days}d") seconds = eta.seconds if seconds >= 3600: hours = int(seconds / 3600) pieces.append(f"{hours}h") seconds -= hours * 3600 if seconds >= 60: minutes = int(seconds / 60) pieces.append(f"{minutes}m") seconds -= minutes * 60 if seconds > 0: pieces.append(f"{seconds}s") return "".join(pieces) PK!aria2p/options.py""" This module defines the Options class, which holds information retrieved with the ``get_option`` or ``get_global_option`` methods of the client. """ class Options: """ This class holds information retrieved with the ``get_option`` or ``get_global_option`` methods of the client. Instances are given a reference to an :class:`api.API` instance to be able to change their values both locally and remotely, by using the API client and calling remote methods to change options. Please refer to aria2c documentation or man pages to see all the available options. """ def __init__(self, api, struct, gid=None): """ Initialization method. Args: api (:class:`api.API`): the reference to an :class:`api.API` instance. struct (dict): a dictionary Python object returned by the JSON-RPC client. gid (str): an optional GID to inform about the owner (:class:`downloads.Download`), or None to tell they are global options. """ __setattr = super().__setattr__ __setattr("api", api) __setattr("_gids", [gid] if gid else []) __setattr("_struct", struct) def __getattr__(self, item): return self._struct.get(item.replace("_", "-")) def __setattr__(self, key, value): if not isinstance(value, str): value = str(value) key = key.replace("_", "-") if self.api.set_options({key: value}, self._gids): self._struct[key] = value # Append _ to continue because it is a reserved keyword @property def continue_(self): """Because ``continue`` is a reserved keyword in Python.""" return self._struct.get("continue") @continue_.setter def continue_(self, value): if not isinstance(value, str): value = str(value) if self.api.set_options({"continue": value}, self._gids): self._struct["continue"] = value PK!!aria2p/stats.py""" This module defines the Stats class, which holds information retrieved with the ``get_global_stat`` method of the client. """ class Stats: """This class holds information retrieved with the ``get_global_stat`` method of the client.""" def __init__(self, struct): """ Initialization method. Args: struct (dict): a dictionary Python object returned by the JSON-RPC client. """ self._struct = struct @property def download_speed(self): """Overall download speed (byte/sec).""" return self._struct.get("downloadSpeed") @property def upload_speed(self): """Overall upload speed(byte/sec).""" return self._struct.get("uploadSpeed") @property def num_active(self): """The number of active downloads.""" return self._struct.get("numActive") @property def num_waiting(self): """The number of waiting downloads.""" return self._struct.get("numWaiting") @property def num_stopped(self): """ The number of stopped downloads in the current session. This value is capped by the --max-download-result option. """ return self._struct.get("numStopped") @property def num_stopped_total(self): """The number of stopped downloads in the current session and not capped by the --max-download-result option.""" return self._struct.get("numStoppedTotal") PK!V~44pyproject.toml[build-system] requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api" [tool.poetry] name = "aria2p" version = "0.1.6" description = "Command-line tool and library to interact with an aria2c daemon process with JSON-RPC." license = "ISC" authors = ["Timothée Mazzucotelli "] readme = 'README.md' repository = "https://github.com/pawamoy/aria2p" homepage = "https://github.com/pawamoy/aria2p" keywords = ['aria2', 'aria2c', 'aria2-cli'] packages = [ { include = "aria2p", from = "src" } ] include = [ "README.md", "pyproject.toml" ] [tool.poetry.dependencies] python = "~3.6" requests = { version = "*" } [tool.poetry.dev-dependencies] pytest = "*" pytest-cov = "*" pytest-sugar = "*" ipython = "^7.2" [tool.poetry.scripts] aria2p = 'aria2p.cli:main' [tool.black] line-length = 120 PK!H M'*'aria2p-0.1.6.dist-info/entry_points.txtN+I/N.,()J,L4*Pz9Vy\\PK!6{aria2p-0.1.6.dist-info/LICENSEISC License Copyright (c) 2018-2019, Timothée Mazzucotelli Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PK!HnHTUaria2p-0.1.6.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!HΘOIaria2p-0.1.6.dist-info/METADATAWRJ?O1*8e\ .`{lA4FhF}Y66ڥ_.0uwإHd<8E| iQ*Q*xq4G  L0ࡐJy@j_]zϾDz1n5S(~f&EҷQ S)]U38bT(Qfן_?@WlO&"[,zr=qd:DKxů j$)*i`I(7:JXu&2mruq4GiOb1 b^{LF)52lq1@d"$x@=8|1K \rH;jV568ł}NeQ6jU)ά+^\)t:|}z!izx`6F#CHXYPqU\ru6l_/#ؐ@v}G 01-dR ^wG+F6CD ʄtڂعWeQX9|14PØ6f0mF:PlcBn ulX=Rh2(ô0iyʤ^Xur 92m/yŰE#Z杦iЏ/=pp$ױqi%M!Y[>Ȕ']iI4 )Bh}HHHJK:ܦpmcG9?hw{W{}<]}COt.mΩ!6(j"w >* f#hUF ~$d5.j}3%O46{\"m} GZŒټ.F~{nJ޳ -*ٕX(*ٍ*%c dwjk"Z^).trSo)ZuoFa-Sm;nM~:ݴLku_]kt^^7+<+;'5vf_n)MN:Q=+ F/0dϴYpdwxѺ{Fp3ATq+7b[Q{N fہLn$݄M4#vЎ&lѲíMRn4 k߿c7?coIWWC#O=x< vxG&)8 v8'wkqE "@?r< 3sV" Q ָV{uy4Y`^s6h㾶wq,ݗ@ͽ. 72y8}o u4,nҾpOD-,[/,M2g[z=ڿm\%Jf4WWjW9/PK!H|AParia2p-0.1.6.dist-info/RECORDuIX[ I3 H_'҉NW_Nm;yґxQvM,C}zX~bcI%O IB؋>"b?P%D'x׭R"kXc UIau 1Rpj#| {/*<kyMJ dQf m":%]X?g"YvS[)T|ZɬgR_<㚶 8bIXsŦRr {>Db#YWԞۤ m ltXYN_[tо3ɓHې2[sU"8ER̆n`Mejt,鲬$ o>*ʄ(7tC[h1&S2};ŧ}}eq&'u%Txa'Ctk7{N 60slmڞ92}&!+eTeޔ",ve8U[?5`~BN˴u K(((dt