Skip to main content

Python wrapper for qBittorrent >4.1.x

Project description

Documentation Status

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.


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
$ cd python-qBittorrent
$ python install


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

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('', verify=False)

API methods

Getting torrents

  • Get all active 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....."
    # 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]
  • Downloading torrents by file:

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

    torrent_file_list = [open('1.torrent', 'rb'), open('2.torrent', 'rb')]
  • 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:

  • Pausing/ Resuming a speicific torrent:

    info_hash = 'e334ab9ddd....infohash....5d7fff526cb4'
  • Pausing/ Resuming multiple torrents:

    info_hash_list = ['e334ab9ddd9......infohash......fff526cb4',

Full API method documentation

All API methods of qBittorrent are mentioned @ Read the docs




By chronological order


  • Write tests

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

python-qbittorrent-0.4.3.tar.gz (9.7 kB view hashes)

Uploaded source

Built Distribution

python_qbittorrent-0.4.3-py3-none-any.whl (9.8 kB view hashes)

Uploaded py3

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