Skip to main content

Support Aria2 rpc client and manage server with async/await

Project description

提供aria2异步客户端的包

本模块提供与aria2异步通信的客户端与管理aria2进程的服务端

使用方法:

示例如下

import aioaria2
import asyncio
from pprint import pprint
async def main():
    async with aioaria2.Aria2HttpClient("id", "http://192.168.0.107:6800/jsonrpc", "normal",
                                        token="admin") as client:
        pprint(await client.getVersion())
asyncio.run(main())

相关ip地址应该换成自己的

client对象的相关方法见aria2手册

import aioaria2
import asyncio
from pprint import pprint
async def main():
    async with aioaria2.Aria2HttpClient("id", "http://192.168.0.107:6800/jsonrpc", "normal",
                                        token="admin") as client:
        pprint(await client.addUri(["http://www.demo.com"])) #即可下载
asyncio.run(main())
运行该协程函数即可,方法对应aria2jsonrpc的方法
对于服务端,每一个实例对应一个aria2进程
import aioaria2
import asyncio
async def main():
    server = aioaria2.AsyncAria2Server(r"128aria2c.exe",
                                       r"--conf-path=aria2.conf", "--rpc-secret=admin", daemon=True)
    await server.start()
    await server.wait()
asyncio.run(main())

即可启动一个aria2进程

参考选项及设置

todolist

  • 异步http通信
  • 异步websocket通信
  • 修复server类的bug
  • 单元测试

jsonrpc 本模块在其之上构建,提供了异步支持,以级websocket支持

windows用户应该加上以下设置

asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
asyncio.set_event_loop(asyncio.ProactorEventLoop())

####Notice #####在最终v1.0发布之前不建议直接setup安装

title

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioaria2-1.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

aioaria2-1.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file aioaria2-1.1.0.tar.gz.

File metadata

  • Download URL: aioaria2-1.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

File hashes

Hashes for aioaria2-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5a123def75edf48f8c7603082ca4c3a4091edd338902e662c3933a1a62b3ae55
MD5 41a3c0859f1ae926cb4bbbcbee129e20
BLAKE2b-256 ea4f07e4afb73cfcf7cb6918f6a11362a0ccf7441fbcfe5582d6c91c0e7406e9

See more details on using hashes here.

File details

Details for the file aioaria2-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: aioaria2-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

File hashes

Hashes for aioaria2-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee1594f10ac5376194936eea5b0b47beb5370b759edc62f10a79efb847a0668c
MD5 58d9da7ebc324cb853e03e13b6b7c655
BLAKE2b-256 240b69e90ebf4dd764410aea9a480af48b869645920225ed8c1067a4df9b671d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page