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


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


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.6.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aioqb-0.1.6-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file aioqb-0.1.6.tar.gz.

File metadata

  • Download URL: aioqb-0.1.6.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for aioqb-0.1.6.tar.gz
Algorithm Hash digest
SHA256 a8ad940a1cc0082e7282008304d28b80acbb6102ce875c0b2e8b71b70a9e92fe
MD5 34eb8a94cb1c22687ef55c15d25a400c
BLAKE2b-256 dcd20e5a64ee728b8faa2dffa105b3672e2050fdaed628e49cd6583e6f3387fb

See more details on using hashes here.

File details

Details for the file aioqb-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: aioqb-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for aioqb-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b9d44ffd28670ef74636a34c47ea7114d3fa7fec09b469e20c45d221aafb1c5b
MD5 a7534649c3f7b12e07a5d5713210d72d
BLAKE2b-256 a9e354a28b5104746fe7bdeec559c1371439babd7eb82b26b2a735e9c5fde1f3

See more details on using hashes here.

Supported by

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