Authentication

class AuthAPIMixIn(host=None, port=None, username=None, password=None, api_key=None, EXTRA_HEADERS=None, REQUESTS_ARGS=None, HTTPADAPTER_ARGS=None, VERIFY_WEBUI_CERTIFICATE=True, FORCE_SCHEME_FROM_HOST=False, RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=False, RAISE_ERROR_FOR_UNSUPPORTED_QBITTORRENT_VERSIONS=False, VERBOSE_RESPONSE_LOGGING=False, SIMPLE_RESPONSES=False, DISABLE_LOGGING_DEBUG_OUTPUT=False) None

Bases: Request

Implementation of all Authorization API methods.

Usage:
>>> from qbittorrentapi import Client
>>> client = Client(host="localhost:8080", username="admin", password="adminadmin")
>>> _ = client.is_logged_in
>>> client.auth_log_in(username="admin", password="adminadmin")
>>> client.auth_log_out()
auth_log_in(username=None, password=None, **kwargs) None

Log in to qBittorrent host.

Raises:
Parameters:
  • username (str | None) – username for qBittorrent client

  • password (str | None) – password for qBittorrent client

Return type:

None

auth_log_out(**kwargs) None

End session with qBittorrent.

Return type:

None

property is_logged_in: bool

Returns True if low-overhead API call succeeds; False otherwise.

There isn’t a reliable way to know if an existing session is still valid without attempting to use it. qBittorrent invalidates cookies when they expire.

Returns:

True/False if current authorization cookie is accepted by qBittorrent

class Authorization(*args, client, **kwargs)

Allows interaction with the Authorization API endpoints.

Usage:
>>> from qbittorrentapi import Client
>>> client = Client(host="localhost:8080", username="admin", password="adminadmin")
>>> is_logged_in = client.auth.is_logged_in
>>> client.auth.log_in(username="admin", password="adminadmin")
>>> client.auth.log_out()
property is_logged_in: bool

Implements is_logged_in().

log_in(username=None, password=None, **kwargs) None

Implements auth_log_in().

Return type:

None

log_out(**kwargs) None

Implements auth_log_out().

Return type:

None