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

Uploaded Source

Built Distribution

aioqb-0.1.3-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aioqb-0.1.3.tar.gz
  • Upload date:
  • Size: 17.5 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.3.tar.gz
Algorithm Hash digest
SHA256 72d7a9403f52d0faf201112e74d572de65574136a28aea09c9c08a41a1d45479
MD5 f967b38a76ea977d8e197553606feb04
BLAKE2b-256 f7abe30f241228f6077fed9677487b368988e47b8944b4204e52981a0ad2bbce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aioqb-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b959c80456578ce0c530f2d340dcfafe7051e0e1dc6377ff3013afe97491615f
MD5 21814d4716293aaca0e90961b061dd82
BLAKE2b-256 b5ae9b917db5427f9dc4252d793cb97e0750690dab9c34ab7e6d14b3afa94726

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