Definitions#

APIKwargsT#

Type Any for kwargs parameters for API methods.

class APINames(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

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, Union[bytes, Tuple[str, bytes]]]

JsonValueT#

Type to define JSON.

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

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[Union[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, Union[None, int, str, bool, Sequence[JsonValueT], Mapping[str, JsonValueT]]]]

class TorrentState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

Torrent States as defined by qBittorrent.

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'#
PAUSED_UPLOAD = 'pausedUP'#
QUEUED_DOWNLOAD = 'queuedDL'#
QUEUED_UPLOAD = 'queuedUP'#
STALLED_DOWNLOAD = 'stalledDL'#
STALLED_UPLOAD = 'stalledUP'#
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#

Returns True if the State is categorized as Paused.

property is_uploading: bool#

Returns True if the State is categorized as Uploading.

class TrackerStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

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#
UPDATING = 3#
WORKING = 2#
property display: str#

Returns a descriptive display value for status.