How to use the aria2p.API function in aria2p

To help you get started, we’ve selected a few aria2p examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pawamoy / aria2p / tests / test_api.py View on Github external
def test_listen_to_notifications_then_stop():
    api = API(Client(port=7128))
    api.listen_to_notifications(threaded=True, timeout=1)
    api.stop_listening()
    assert api.listener is None
github pawamoy / aria2p / tests / test_downloads.py View on Github external
def test_eq_method(self):
        assert self.download == Download(API(), {"gid": "0a6635c602761000"})
github pawamoy / aria2p / tests / test_downloads.py View on Github external
def test_init_method(self):
        assert Download(API(), {})
github pawamoy / aria2p / tests / __init__.py View on Github external
command.append(f"--input-file={session_path}")
            else:
                if not session.exists():
                    raise ValueError(f"no such session: {session}")
                command.append(f"--input-file={session}")
        if secret:
            command.append(f"--rpc-secret={secret}")

        self.command = command
        self.process = None

        # create the client with port
        self.client = aria2p.Client(port=self.port, secret=secret)

        # create the API instance
        self.api = aria2p.API(self.client)
github pawamoy / aria2p / tests / test_options.py View on Github external
def setup_method(self):
        self.api = API()
        self.api.set_global_options = lambda x: True
        self.options = Options(self.api, {})
github pawamoy / aria2p / tests / test_downloads.py View on Github external
def setup_method(self):
        self.bitfield = (
            "9e7ef5fbdefdffffdfffffffffffffdf7fff5dfefff7feffefffdff7fffffffbfeffbffddf7de9f7eefffffffeffe77bb"
            "f8fdbdcffef7fffffbefad7ffffffbf55bff7edfedfeff7ffff7ffffff3ffff7d3ffbfffddddffe7ffffffffffdedf7fd"
            "fef62fbdfffffbffbffdcfaffffafebeff3ebff7d5fffbbb2bafef77ffaffe7d37fbffffffb6dfffffffedfebbecbbffe"
            "bdefffffffff977f7ffdffee7fffffffdfeb3f67dddffeedfffffbfffffdaffbfeedfadef6dfd9d2df9fb7f689ffcff3f"
            "fbfebbfdbd7fcddfa77dfddffdfe327fdcbf77fad87ffff6ff7ffebfefdfbbffdefdafeefed7fefffe7ffad9ffdcffefc"
            "ffbbf3c07ef7fc0"
        )
        self.download = Download(
            API(),
            {
                "bitfield": self.bitfield,
                "bittorrent": {},
                "completedLength": "889592532",
                "connections": "44",
                "dir": "/home/pawamoy/Downloads/torrents/tmp",
                "downloadSpeed": "745509",
                "files": [
                    {
                        "completedLength": "58132",
                        "index": "1",
                        "length": "58132",
                        "path": "/home/pawamoy/Downloads/torrents/tmp/dl/logo.jpg",
                        "selected": "true",
                        "uris": [],
                    },
github pawamoy / aria2p / tests / test_options.py View on Github external
def setup_method(self):
        self.api = API()