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
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.5.tar.gz
(17.5 kB
view details)
Built Distribution
aioqb-0.1.5-py3-none-any.whl
(15.2 kB
view details)
File details
Details for the file aioqb-0.1.5.tar.gz
.
File metadata
- Download URL: aioqb-0.1.5.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68f29f5ce616c6ca66836405fbf5db4c1cba56d4ba579a09da4618fd69f9c0dc |
|
MD5 | cf52b48047257069f21ea2e97f39e221 |
|
BLAKE2b-256 | f4c4121e9ba743a35ccb20650d1f9dfa2959c463b92929577cebeeb83dcc5ea3 |
File details
Details for the file aioqb-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: aioqb-0.1.5-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47cf7b0c5b3a2d28b795c525295a100f72b2708bc7cb80925023c59a9c58c5a0 |
|
MD5 | 6e25b7545fc7a97025ff589704a7c323 |
|
BLAKE2b-256 | d4d1a7fb4caf28589f157ce515657ad4bd7b3b3af0a20886107253fb18808950 |