Support qbittorrent rpc client and manage server with async/await
Project description
✨ aioqb ✨
The asyncio Qbittorrent Client
The asyncio Qbittorrent Client
import asyncio
import aioqb
async def main():
client = aioqb.QbittorrentClient()
await client.torrents_add(torrents=[open("xxx.torrent", "rb")])
print(await client.transfer_info())
print(await client.torrents_info())
asyncio.run(main())
Auto ban thunder
"""
Copyright (c) 2008-2022 synodriver <synodriver@gmail.com>
"""
# Auto ban xunlei without qbee
import asyncio
from pprint import pprint
from aioqb import Client
block_list = ["xl", "xunlei"]
async def main():
async with Client() as client:
pprint(await client.auth_login())
while True:
d = await client.sync_maindata()
# pprint(d)
torrent_hashs = d['torrents'].keys()
rid = d['rid']
for t in torrent_hashs:
data = await client.sync_torrentPeers(hash=t, rid=0)
# filter(lambda x: for ip, peer in data["peers"].items() if , block_list)
for ip, peer in data["peers"].items():
# print(ip)
# pprint(v)
for b in block_list:
if b in peer['client'].lower():
await client.transfer_banPeers(ip)
print(f"ban peer {ip} {peer['client']}")
break
await asyncio.sleep(1)
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aioqb-0.1.3.tar.gz
(17.5 kB
view hashes)
Built Distribution
aioqb-0.1.3-py3-none-any.whl
(15.2 kB
view hashes)