Definitions

APIKwargsT

Type Any for kwargs parameters for API methods.

class APINames(*values)

Bases: str, Enum

API namespaces for API endpoints.

e.g torrents in http://localhost:8080/api/v2/torrents/addTrackers

Application = 'app'
Authorization = 'auth'
EMPTY = ''
Log = 'log'
RSS = 'rss'
Search = 'search'
Sync = 'sync'
TorrentCreator = 'torrentcreator'
Torrents = 'torrents'
Transfer = 'transfer'
class ClientCache(*args, client, **kwargs)

Bases: Generic[ClientT]

Caches the client.

Subclass this for any object that needs access to the Client.

class ClientT

Type for this API Client.

alias of TypeVar(‘ClientT’, bound=Request)

class Dictionary(data=None, **kwargs)

Bases: AttrDict[V]

Base definition of dictionary-like objects returned from qBittorrent.

FilesToSendT

Type for Files input to API method.

alias of Mapping[str, bytes | tuple[str, bytes]]

JsonValueT = None | int | str | bool | collections.abc.Sequence['JsonValueT'] | collections.abc.Mapping[str, 'JsonValueT']

Type to define JSON.

class List(list_entries=None, entry_class=None, **kwargs)

Bases: UserList[ListEntryT]

Base definition for list-like objects returned from qBittorrent.

class ListEntry(data=None, **kwargs)

Bases: Dictionary[None | int | str | bool | Sequence[JsonValueT] | Mapping[str, JsonValueT]]

Base definition for objects within a list returned from qBittorrent.

class ListEntryT

Type for entry in List from API.

alias of TypeVar(‘ListEntryT’, bound=ListEntry)

ListInputT

Type for List input to API method.

alias of Iterable[Mapping[str, None | int | str | bool | Sequence[JsonValueT] | Mapping[str, JsonValueT]]]

class TorrentState(*values)

Bases: str, Enum

Torrent States as defined by qBittorrent.

Note: In qBittorrent v5.0.0:
  • PAUSED_UPLOAD was renamed to STOPPED_UPLOAD

  • PAUSED_DOWNLOAD was renamed to STOPPED_DOWNLOAD

Definitions:
Usage:
>>> from qbittorrentapi import Client, TorrentState
>>> client = Client()
>>> # print torrent hashes for torrents that are downloading
>>> for torrent in client.torrents_info():
>>>     # check if torrent is downloading
>>>     if torrent.state_enum.is_downloading:
>>>         print(f'{torrent.hash} is downloading...')
>>>     # the appropriate enum member can be directly derived
>>>     state_enum = TorrentState(torrent.state)
>>>     print(f'{torrent.hash}: {state_enum.value}')
ALLOCATING = 'allocating'
CHECKING_DOWNLOAD = 'checkingDL'
CHECKING_RESUME_DATA = 'checkingResumeData'
CHECKING_UPLOAD = 'checkingUP'
DOWNLOADING = 'downloading'
ERROR = 'error'
FORCED_DOWNLOAD = 'forcedDL'
FORCED_METADATA_DOWNLOAD = 'forcedMetaDL'
FORCED_UPLOAD = 'forcedUP'
METADATA_DOWNLOAD = 'metaDL'
MISSING_FILES = 'missingFiles'
MOVING = 'moving'
PAUSED_DOWNLOAD = 'pausedDL'

pausedDL was renamed to stoppedDL in Web API v2.11.0

PAUSED_UPLOAD = 'pausedUP'

pausedUP was renamed to stoppedUP in Web API v2.11.0

QUEUED_DOWNLOAD = 'queuedDL'
QUEUED_UPLOAD = 'queuedUP'
STALLED_DOWNLOAD = 'stalledDL'
STALLED_UPLOAD = 'stalledUP'
STOPPED_DOWNLOAD = 'stoppedDL'
STOPPED_UPLOAD = 'stoppedUP'
UNKNOWN = 'unknown'
UPLOADING = 'uploading'
property is_checking: bool

Returns True if the State is categorized as Checking.

property is_complete: bool

Returns True if the State is categorized as Complete.

property is_downloading: bool

Returns True if the State is categorized as Downloading.

property is_errored: bool

Returns True if the State is categorized as Errored.

property is_paused: bool

Alias of TorrentState.is_stopped

property is_stopped: bool

Returns True if the State is categorized as Stopped.

property is_uploading: bool

Returns True if the State is categorized as Uploading.

class TrackerStatus(*values)

Bases: int, Enum

Tracker Statuses as defined by qBittorrent.

Definitions:
Usage:
>>> from qbittorrentapi import Client, TrackerStatus
>>> client = Client()
>>> # print torrent hashes for torrents that are downloading
>>> for torrent in client.torrents_info():
>>>     for tracker in torrent.trackers:
>>>         # display status for each tracker
>>>         print(f"{torrent.hash[-6:]}: {TrackerStatus(tracker.status).display:>13} :{tracker.url}")
DISABLED = 0
NOT_CONTACTED = 1
NOT_WORKING = 4
TRACKER_ERROR = 5
UNREACHABLE = 6
UPDATING = 3
WORKING = 2
property display: str

Returns a descriptive display value for status.