Metadata-Version: 2.1
Name: aioaria2
Version: 1.2.2
Summary: Support Aria2 rpc client and manage server with async/await
Home-page: UNKNOWN
Author: ['帝国皇家近卫军', 'synodriver']
Author-email: diguohuangjiajinweijun@gmail.com
Maintainer: v-vinson
License: GPLv3
Keywords: asyncio,Aria2
Platform: UNKNOWN
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aiohttp
Requires-Dist: aiofiles

提供aria2异步客户端的包
===

# 本模块提供与aria2异步通信的客户端与管理aria2进程的服务端
### [pypi地址](https://pypi.org/project/aioaria2/)
## 使用方法：
### 示例如下
```python
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手册 
```python
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进程
```python
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进程
[参考选项及设置](http://aria2.github.io/manual/en/html/)
### todolist
- [x] 异步http通信
- [x] 异步websocket通信
- [x] 修复server类的bug
- [ ] 单元测试


[jsonrpc](https://xyne.archlinux.ca/projects/python3-aria2jsonrpc)
        本模块在其之上构建，提供了异步支持，以级websocket支持

### windows用户应该加上以下设置     
```
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
asyncio.set_event_loop(asyncio.ProactorEventLoop())
```
#### Notice
##### 在最终v1.0发布之前不建议直接setup安装

#### v1.2更新
新增Aria2WebsocketTrigger类，可以监听websocket消息,
使用on*方法注册自定义回调函数,既可以是同步也可以是异步的

如下
```
@trigger.onDownloadStart
async def onDownloadStart(trigger, future):
    print("下载开始{0}".format(future.result()))
```



![title](https://konachan.com/sample/c7f565c0cd96e58908bc852dd754f61a/Konachan.com%20-%20302356%20sample.jpg)

