Torrent Creator#

class TorrentCreatorAPIMixIn(host=None, port=None, username=None, password=None, EXTRA_HEADERS=None, REQUESTS_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: AppAPIMixIn

Implementation of all TorrentCreator API methods.

Usage:
>>> from qbittorrentapi import Client
>>> client = Client(host="localhost:8080", username="admin", password="adminadmin")
>>> task = client.torrentcreator_add_task(source_path="/path/to/data")
>>> if TaskStatus(task.status().status) == TaskStatus.FINISHED:
>>>     torrent_data = task.torrent_file()
>>> task.delete()
>>> # or
>>> client.torrentcreator_delete_task(task_id=task.taskID)
torrentcreator_add_task(source_path=None, torrent_file_path=None, format=None, start_seeding=None, is_private=None, optimize_alignment=None, padded_file_size_limit=None, piece_size=None, comment=None, trackers=None, url_seeds=None, **kwargs) TorrentCreatorTaskDictionary#

Add a task to create a new torrent.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:

Conflict409Error – too many existing torrent creator tasks

Parameters:
  • source_path (str | PathLike[Any] | None) – source file path for torrent content

  • torrent_file_path (str | PathLike[Any] | None) – file path to save torrent

  • format (Optional[Literal['v1', 'v2', 'hybrid']]) – BitTorrent V1 or V2; defaults to “hybrid” format if None

  • start_seeding (bool | None) – should qBittorrent start seeding this torrent?

  • is_private (bool | None) – is the torrent private or not?

  • optimize_alignment (bool | None) – should optimized alignment be enforced for new torrent?

  • padded_file_size_limit (int | None) – size limit for padding files

  • piece_size (int | None) – size of the pieces

  • comment (str | None) – comment

  • trackers (str | list[str] | None) – list of trackers to add

  • url_seeds (str | list[str] | None) – list of URLs seeds to add

Return type:

TorrentCreatorTaskDictionary

torrentcreator_delete_task(task_id=None, **kwargs) None#

Delete a torrent creation task.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:

NotFound404Error – task not found

Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

None

torrentcreator_status(task_id=None, **kwargs) TorrentCreatorTaskStatusList#

Status for a torrent creation task.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:

NotFound404Error – task not found

Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

TorrentCreatorTaskStatusList

torrentcreator_torrent_file(task_id=None, **kwargs) bytes#

Retrieve torrent file for created torrent.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:
Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

bytes

class TorrentCreator(*args, client, **kwargs)#

Allows interaction with TorrentCreator API endpoints.

Usage:
>>> from qbittorrentapi import Client
>>> client = Client(host="localhost:8080", username="admin", password="adminadmin")
>>> # this is all the same attributes that are available as named in the
>>> #  endpoints or the more pythonic names in Client (with or without 'torrentcreator_' prepended)
>>> task = client.torrentcreator.add_task(source_path="/path/to/data")
>>> if TaskStatus(task.status().status) == TaskStatus.FINISHED:
>>>     torrent_data = task.torrent_file()
>>> task.delete()
>>> # or
>>> client.torrentcreator.delete_task(task_id=task.taskID)
add_task(source_path=None, torrent_file_path=None, format=None, start_seeding=None, is_private=None, optimize_alignment=None, padded_file_size_limit=None, piece_size=None, comment=None, trackers=None, url_seeds=None, **kwargs) TorrentCreatorTaskDictionary#

Add a task to create a new torrent.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:

Conflict409Error – too many existing torrent creator tasks

Parameters:
  • source_path (str | PathLike[Any] | None) – source file path for torrent content

  • torrent_file_path (str | PathLike[Any] | None) – file path to save torrent

  • format (Optional[Literal['v1', 'v2', 'hybrid']]) – BitTorrent V1 or V2; defaults to “hybrid” format if None

  • start_seeding (bool | None) – should qBittorrent start seeding this torrent?

  • is_private (bool | None) – is the torrent private or not?

  • optimize_alignment (bool | None) – should optimized alignment be enforced for new torrent?

  • padded_file_size_limit (int | None) – size limit for padding files

  • piece_size (int | None) – size of the pieces

  • comment (str | None) – comment

  • trackers (str | list[str] | None) – list of trackers to add

  • url_seeds (str | list[str] | None) – list of URLs seeds to add

Return type:

TorrentCreatorTaskDictionary

delete_task(task_id=None, **kwargs) None#

Delete a torrent creation task.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:

NotFound404Error – task not found

Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

None

status(task_id=None, **kwargs) TorrentCreatorTaskStatusList#

Status for a torrent creation task.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:

NotFound404Error – task not found

Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

TorrentCreatorTaskStatusList

torrent_file(task_id=None, **kwargs) bytes#

Retrieve torrent file for created torrent.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:
Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

bytes

class TorrentCreatorTaskDictionary(data, client)#

Bases: ClientCache[TorrentCreatorAPIMixIn], Dictionary[Union[None, int, str, bool, Sequence[JsonValueT], Mapping[str, JsonValueT]]]

Response for torrentcreator_add_task()

delete(task_id=None, **kwargs) None#

Delete a torrent creation task.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:

NotFound404Error – task not found

Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

None

status(task_id=None, **kwargs) TorrentCreatorTaskStatusList#

Status for a torrent creation task.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:

NotFound404Error – task not found

Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

TorrentCreatorTaskStatusList

torrent_file(task_id=None, **kwargs) bytes#

Retrieve torrent file for created torrent.

This method was introduced with qBittorrent v5.0.0 (Web API v2.10.4).

Raises:
Parameters:

task_id (str | None) – ID of torrent creation task

Return type:

bytes

class TorrentCreatorTaskStatus(data=None, **kwargs)#

Bases: ListEntry

Item in TorrentCreatorTaskStatusList

Definition: not documented…yet

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

Bases: Enum

Enumeration of possible task statuses.

FAILED = 'Failed'#
FINISHED = 'Finished'#
QUEUED = 'Queued'#
RUNNING = 'Running'#
class TorrentCreatorTaskStatusList(list_entries, client=None)#

Bases: List[TorrentCreatorTaskStatus]

Response for torrentcreator_status()