Skip to main content

Support qbittorrent rpc client and manage server with async/await

Project description

✨ aioqb ✨

The asyncio Qbittorrent Client

pypi python implementation wheel license action

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())

Auto ban thunder

Copyright (c) 2008-2022 synodriver <>
# 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']}")
            await asyncio.sleep(1)

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

aioqb-0.1.1.tar.gz (15.8 kB view hashes)

Uploaded source

Built Distribution

aioqb-0.1.1-py3-none-any.whl (14.9 kB view hashes)

Uploaded py3

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