Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
qbittorrent-api
Readme
Currently supports qBittorrent v4.6.4 (Web API v2.9.3) released on March 23, 2024.
User Guide and API Reference available on Read the Docs.
Install via pip from PyPI
python -m pip install qbittorrent-api
import qbittorrentapi
# instantiate a Client using the appropriate WebUI configuration
conn_info = dict(
host="localhost",
port=8080,
username="admin",
password="adminadmin",
)
qbt_client = qbittorrentapi.Client(**conn_info)
# the Client will automatically acquire/maintain a logged-in state
# in line with any request. therefore, this is not strictly necessary;
# however, you may want to test the provided login credentials.
try:
qbt_client.auth_log_in()
except qbittorrentapi.LoginFailed as e:
print(e)
# if the Client will not be long-lived or many Clients may be created
# in a relatively short amount of time, be sure to log out:
qbt_client.auth_log_out()
# or use a context manager:
with qbittorrentapi.Client(**conn_info) as qbt_client:
if qbt_client.torrents_add(urls="...") != "Ok.":
raise Exception("Failed to add torrent.")
# display qBittorrent info
print(f"qBittorrent: {qbt_client.app.version}")
print(f"qBittorrent Web API: {qbt_client.app.web_api_version}")
for k, v in qbt_client.app.build_info.items():
print(f"{k}: {v}")
# retrieve and show all torrents
for torrent in qbt_client.torrents_info():
print(f"{torrent.hash[-6:]}: {torrent.name} ({torrent.state})")
# pause all torrents
qbt_client.torrents.pause.all()
torrents/count
(#366)hash
and hashes
; use torrent_hash
and torrent_hashes
, respectively (#345)
client.torrents_info(hashes="...")
with client.torrents_info(torrent_hashes="...")
inactive_seeding_time_limit
for torrents/setShareLimits
(#271)app/networkInterfaceList
and app/networkInterfaceAddressList
(#272)APINames
and TorrentStatus
to StrEnum
and TrackerStatus
to IntEnum
(#267)Client
is no longer binded to List
s (#230)List
sClient
can now be used as a context managersrc-layout
TrackerStatus
Enum to identify tracker statuses from torrents/trackers
seeding
, moving
, errored
, and checking
SID
torrents/export
transfer/setSpeedLimitsMode
in place of existing transfer/toggleSpeedLimitsMode
stopCondition
in torrents/add
PYTHON_
prefix for configuration environment variablessetuptools
as an explicit dependency for pkg_resources.parse_version()
Request
for some more clarity (hopefully)savePath
back to save_path
torrents/info
results can now be filtered by a torrent tagOrigin
and Referer
headers (Fixes #63)torrents/files
includes index
for each file; index
officially replaces id
but id
will still be populatedFORCE_SCHEME_FROM_HOST
(fixes #54)TorrentStates.FORCE_DOWNLOAD='forceDL'
with TorrentStates.FORCED_DOWNLOAD='forcedDL'
requests.py
so it's better and easier to readattrdict
is apparently going to break in Python 3.10 and it is no longer maintained, I've vendored a modified version (fixes #45)handle_hashes
decorator to hide the cruft of continuing to support hash and hashes argumentstorrents/renameFile
and torrents/renameFolder
endpointstorrents/add
supports adding torrents with tags via tags
parameterapp/preferences
supports toggling internationalized domain name (IDN) support via idn_support_enabled
torrents/add
, is_root_folder
(or root_folder
) is superseded by content_layout
torrents/delete
, delete_files
now defaults to False
instead of required being explicitly passedClient(host='localhost/qbt')
and all API endpoint paths will be prefixed with "/qbt"content_path
from torrents/info
torrent_files
in torrents_add()
for Python 3 (Fixes #34)search/categories
no longer returns anything and rss/renameRule
works againenum34
for Python 2TorrentStates
enum for qBittorrent list of torrent stateshash
and hashes
are renamed to torrent_hash
and torrent_hashes
. hash
and hashes
remain supportedsearch_uninstall_plugin
now works. search_enable_plugin now supports multiple pluginsTorrent.download_limit
now only return the value instead of a dictionary. Torrent.upload_limit
now worksrss/markAsRead
and rss/matchingArticles
. Added in v2.5.1 (Fixes #10)stalled()
, stalled_uploading()
, and stalled_downloading()
to torrents.info
interaction; added in Web API v2.4.1torrents_files()
now contains file ID in id
SIMPLE_RESPONSES
for the entire client and individual methodsrequests
and urllib3
app/buildInfo
transfer/banPeers
and torrents/addPeers
torrents/addTags
, torrents/removeTags
, torrents/tags
, torrents/createTags
, and torrents/deleteTags
client.torrents_add()
so auto torrent management worksClient
classMIT License
Copyright (c) Russell Martin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Python client for qBittorrent v4.1+ Web API.
We found that qbittorrent-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.