Skip to main content
Documentation Status https://badge.fury.io/py/python-qbittorrent.svg

Python wrapper for qBittorrent Web API (for versions above 4.1, for version below and above v3.1.x please use 0.3.1 version).

For qBittorrent clients with earlier versions, use mookfist’s python-qbittorrent.

This wrapper is based on the methods described in qBittorrent’s Official Web API Documentation

Some methods are only supported in qBittorent’s latest version (v3.3.1 when writing).

It’ll be best if you upgrade your client to a latest version.

Installation

The best way is to install a stable release from PyPI:

$ pip install python-qbittorrent

You can also stay on the bleeding edge of the package:

$ git clone https://github.com/v1k45/python-qBittorrent.git
$ cd python-qBittorrent
$ python setup.py install

Prerequisite

qBittorent webUI must be enabled before using this API client. How to enable the qBittorrent Web UI

Quick usage guide

from qbittorrent import Client

qb = Client('http://127.0.0.1:8080/')

qb.login('admin', 'your-secret-password')
# not required when 'Bypass from localhost' setting is active.
# defaults to admin:admin.
# to use defaults, just do qb.login()

torrents = qb.torrents()

for torrent in torrents:
    print torrent['name']

If you have enabled SSL and are using a self-signed certificate, you’d probably want to disable SSL verification. This can be done by passing verify=False while initializing the Client.

from qbittorrent import Client

qb = Client('https://127.0.0.1:8080/', verify=False)

API methods

Getting torrents

  • Get all active torrents:

    qb.torrents()
  • Filter torrents:

    qb.torrents(filter='downloading', category='my category')
    # This will return all torrents which are currently
    # downloading and are labeled as ``my category``.
    
    qb.torrents(filter='paused', sort='ratio')
    # This will return all paused torrents sorted by their Leech:Seed ratio.

Refer qBittorents WEB API documentation for all possible filters.

Downloading torrents

  • Download torrents by link:

    magnet_link = "magnet:?xt=urn:btih:e334ab9ddd91c10938a7....."
    qb.download_from_link(magnet_link)
    
    # No matter the link is correct or not,
    # method will always return empty JSON object.
  • Download multipe torrents by list of links:

    link_list = [link1, link2, link3]
    qb.download_from_link(link_list)
  • Downloading torrents by file:

    torrent_file = open('my-torrent-file.torrent', 'rb')
    qb.download_from_file(torrent_file)
  • Downloading multiple torrents by using files:

    torrent_file_list = [open('1.torrent', 'rb'), open('2.torrent', 'rb')]
    qb.download_from_file(torrent_file_list)
  • Specifing save path for downloads:

    dl_path = '/home/user/Downloads/special-dir/'
    qb.download_from_file(myfile, savepath=dl_path)
    
    # same for links.
    qb.download_from_link(my_magnet_uri, savepath=dl_path)
  • Applying labels to downloads:

    qb.download_from_file(myfile, label='secret-files ;) ')
    
    # same for links.
    qb.download_from_link(my_magnet_uri, category='anime')

Pause / Resume torrents

  • Pausing/ Resuming all torrents:

    qb.pause_all()
    qb.resume_all()
  • Pausing/ Resuming a speicific torrent:

    info_hash = 'e334ab9ddd....infohash....5d7fff526cb4'
    qb.pause(info_hash)
    qb.resume(info_hash)
  • Pausing/ Resuming multiple torrents:

    info_hash_list = ['e334ab9ddd9......infohash......fff526cb4',
                      'c9dc36f46d9......infohash......90ebebc46',
                      '4c859243615......infohash......8b1f20108']
    
    qb.pause_multiple(info_hash_list)
    qb.resume_multipe(info_hash_list)

Full API method documentation

All API methods of qBittorrent are mentioned @ Read the docs

Authors

Maintainer

Contributors

By chronological order

TODO

  • Write tests

Metadata

Release files for python-qbittorrent 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-qbittorrent 0.4.3
File Size Uploaded
python-qbittorrent-0.4.3.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-qbittorrent 0.4.3
File Interpreter ABI Platform
python_qbittorrent-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / python-qbittorrent-0.4.3.tar.gz

Download URL python-qbittorrent-0.4.3.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4e22cf89890628b054a60aa4bd1161a68c2b0fad48ef0886fa4d325e69d3828a
BLAKE2b-256 checksum
How to use checksums
8625a5ad35ad229c8016a8c98327495e649cb795be2fda63f8cace6c9a739af7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Release files / python_qbittorrent-0.4.3-py3-none-any.whl

Download URL python_qbittorrent-0.4.3-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc2583226b69916ab96735537abd7696acc52e02e2d4d7afd10fa976f10d3aaa
BLAKE2b-256 checksum
How to use checksums
e2839dd55e6c916b1dc6ce1fdd373c1c0c4aa1635bbc5f2e1c8770987625631f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

1 release file

0.4.1

1 release file

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page