Torrents¶
- class TorrentsAPIMixIn(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:
AppAPIMixInImplementation of all Torrents API methods.
- Usage:
>>> from qbittorrentapi import Client >>> client = Client(host="localhost:8080", username="admin", password="adminadmin") >>> client.torrents_add(urls="...") >>> client.torrents_reannounce()
- torrents_add(urls=None, torrent_files=None, save_path=None, cookie=None, category=None, is_skip_checking=None, is_paused=None, is_root_folder=None, rename=None, upload_limit=None, download_limit=None, use_auto_torrent_management=None, is_sequential_download=None, is_first_last_piece_priority=None, tags=None, content_layout=None, ratio_limit=None, seeding_time_limit=None, download_path=None, use_download_path=None, stop_condition=None, add_to_top_of_queue=None, inactive_seeding_time_limit=None, share_limit_action=None, ssl_certificate=None, ssl_private_key=None, ssl_dh_params=None, is_stopped=None, forced=None, file_priorities=None, downloader=None, share_limits_mode=None, **kwargs) str | TorrentsAddedMetadata¶
Add one or more torrents by URLs and/or torrent files.
Returns
Ok.for success andFails.for failure.- Raises:
UnsupportedMediaType415Error – if file is not a valid torrent file
TorrentFileNotFoundError – if a torrent file doesn’t exist
TorrentFilePermissionError – if read permission is denied to torrent file
Conflict409Error – torrent is already added to qBittorrent
- Parameters:
urls (
str|Iterable[str] |None) – single instance or an iterable of URLs (http://,https://,magnet:,bc://bt/)torrent_files (
TypeVar(TorrentFilesT,bytes,str,IO[bytes],Mapping[str,bytes|str|IO[bytes]],Iterable[bytes|str|IO[bytes]]) |None) –several options are available to send torrent files to qBittorrent:
single instance of bytes: useful if torrent file already read from disk or downloaded from internet.
single instance of file handle to torrent file: use
open(<filepath>, 'rb')to open the torrent file.single instance of a filepath to torrent file: e.g.
/home/user/torrent_filename.torrentan iterable of the single instances above to send more than one torrent file
dictionary with key/value pairs of torrent name and single instance of above object
Note: The torrent name in a dictionary is useful to identify which torrent file errored. qBittorrent provides back that name in the error text. If a torrent name is not provided, then the name of the file will be used. And in the case of bytes (or if filename cannot be determined), the value ‘torrent__n’ will be used.
is_paused (
bool|None) – Adds torrent in stopped state; alias foris_stoppedis_root_folder (
bool|None) –TrueorFalseto create root folder (superseded by content_layout with v4.3.2)upload_limit (
str|int|None) – upload limit in bytes/seconddownload_limit (
str|int|None) – download limit in bytes/seconduse_auto_torrent_management (
bool|None) –TrueorFalseto use automatic torrent managementis_sequential_download (
bool|None) –TrueorFalsefor sequential downloadis_first_last_piece_priority (
bool|None) –TrueorFalsefor first and last piece download prioritytags (
str|Iterable[str] |None) – tag(s) to assign to torrent(s) (added in Web API v2.6.2)content_layout (
Literal['Original','Subfolder','NoSubfolder'] |None) –Original,Subfolder, orNoSubfolderto control filesystem structure for content (added in Web API v2.7)ratio_limit (
str|float|None) – share limit as ratio of upload amt over download amt; e.g. 0.5 or 2.0 (added in Web API v2.8.1)seeding_time_limit (
str|int|None) – number of minutes to seed torrent (added in Web API v2.8.1)download_path (
str|None) – location to download torrent content before moving tosave_path(added in Web API v2.8.4)use_download_path (
bool|None) –TrueorFalsewhetherdownload_pathshould be used…defaults toTrueifdownload_pathis specified (added in Web API v2.8.4)stop_condition (
Literal['MetadataReceived','FilesChecked'] |None) –MetadataReceivedorFilesCheckedto stop the torrent when started automatically (added in Web API v2.8.15)add_to_top_of_queue (
bool|None) – puts torrent at top to the queue(added in Web API v2.8.19)inactive_seeding_time_limit (
str|int|None) – limit for seeding while inactive (added in Web API v2.9.2)share_limit_action (
Literal['Stop','Remove','RemoveWithContent','EnableSuperSeeding'] |None) – override default action when share limit is reached (added in Web API v2.10.4)ssl_certificate (
str|None) – peer certificate (in PEM format) (added in Web API v2.10.4)ssl_private_key (
str|None) – peer private key (added in Web API v2.10.4)ssl_dh_params (
str|None) – Diffie-Hellman parameters (added in Web API v2.10.4)is_stopped (
bool|None) – Adds torrent in stopped state; alias foris_paused(added in Web API v2.11.0)forced (
bool|None) – add torrent in forced state (added in Web API v2.11.0)file_priorities (
Iterable[int] |None) – priority for each file in the torrent; must contain one entry per file and cannot be used when adding multiple torrents or when uploading torrent files (added in Web API v2.11.9)downloader (
str|None) – name of the search plugin to download the torrent with; only applies when adding by URL (added in Web API v2.13.1)share_limits_mode (
Literal['Default','MatchAny','MatchAll'] |None) – mode once share limit is reached. Options: Default, MatchAny, MatchAll (added in Web API v2.16.0)
- Return type:
- torrents_add_peers(peers=None, torrent_hashes=None, **kwargs) TorrentsAddPeersDictionary¶
Add one or more peers to one or more torrents.
This method was introduced with qBittorrent v4.4.0 (Web API v2.3.0).
- Raises:
InvalidRequest400Error – for invalid peers
- Parameters:
- Return type:
- torrents_add_tags(tags=None, torrent_hashes=None, **kwargs) None¶
Add one or more tags to one or more torrents.
Note: Tags that do not exist will be created on-the-fly.
This method was introduced with qBittorrent v4.2.0 (Web API v2.3.0).
- torrents_add_webseeds(torrent_hash=None, urls=None, **kwargs) None¶
Add webseeds to a torrent.
- Raises:
NotFound404Error – torrent not found
InvalidRequest400Error – invalid URL
- Parameters:
- Return type:
- torrents_bottom_priority(torrent_hashes=None, **kwargs) None¶
Set torrent as lowest priority. Torrent Queuing must be enabled.
- torrents_categories(**kwargs) TorrentCategoriesDictionary¶
Retrieve all category definitions.
This method was introduced with qBittorrent v4.1.4 (Web API v2.1.1).
Note:
torrents/categoriesis not available until v2.1.0- Return type:
- torrents_create_category(name=None, save_path=None, download_path=None, enable_download_path=None, **kwargs) None¶
Create a new torrent category.
- Raises:
Conflict409Error – if category name is not valid or unable to create
- Parameters:
- Return type:
- torrents_create_tags(tags=None, **kwargs) None¶
Create one or more tags.
This method was introduced with qBittorrent v4.2.0 (Web API v2.3.0).
- torrents_decrease_priority(torrent_hashes=None, **kwargs) None¶
Decrease the priority of a torrent. Torrent Queuing must be enabled.
- torrents_delete(delete_files=False, torrent_hashes=None, **kwargs) None¶
Remove a torrent from qBittorrent and optionally delete its files.
- torrents_delete_tags(tags=None, **kwargs) None¶
Delete one or more tags.
This method was introduced with qBittorrent v4.2.0 (Web API v2.3.0).
- torrents_download_file(torrent_hash=None, file=None, **kwargs) str¶
The file system path for a fully downloaded file within a torrent.
This method was introduced with qBittorrent v5.3.0 (Web API v2.16.0).
- Raises:
NotFound404Error – torrent not found
Conflict409Error – torrent metadata unavailable, file not found, or file not fully downloaded
- Parameters:
- Return type:
- torrents_download_limit(torrent_hashes=None, **kwargs) TorrentLimitsDictionary¶
Retrieve the download limit for one or more torrents.
- Return type:
- torrents_edit_category(name=None, save_path=None, download_path=None, enable_download_path=None, **kwargs) None¶
Edit an existing category.
This method was introduced with qBittorrent v4.1.3 (Web API v2.1.0).
- Raises:
Conflict409Error – if category name is not valid or unable to create
- Parameters:
- Return type:
- torrents_edit_tracker(torrent_hash=None, original_url=None, new_url=None, tier=None, **kwargs) None¶
Replace a torrent’s tracker with a different one.
This method was introduced with qBittorrent v4.1.4 (Web API v2.2.0).
- Raises:
- Parameters:
- Return type:
- torrents_edit_webseed(torrent_hash=None, orig_url=None, new_url=None, **kwargs) None¶
Edit a webseed for a torrent.
- Raises:
NotFound404Error – torrent not found
Conflict409Error –
orig_urlis not a webseed for the torrentInvalidRequest400Error – invalid URL
- Parameters:
- Return type:
- torrents_export(torrent_hash=None, **kwargs) bytes¶
Export a .torrent file for the torrent.
This method was introduced with qBittorrent v4.5.0 (Web API v2.8.14).
- Raises:
NotFound404Error – torrent not found
Conflict409Error – unable to export .torrent file
- Parameters:
- Return type:
- torrents_fetch_metadata(source=None, downloader=None, **kwargs) TorrentMetadataDictionary¶
Retrieve the metadata for a torrent without adding it to qBittorrent.
This method was introduced with qBittorrent v5.2.0 (Web API v2.11.9).
Metadata is not necessarily available immediately. When qBittorrent must fetch it from peers or download it from a URL, the response is empty and qBittorrent continues retrieving it in the background; call this method again with the same
sourceto collect the result.- Raises:
InvalidRequest400Error – if
sourcecannot be parsed ordownloaderis not a valid search plugin- Parameters:
- Return type:
- torrents_file_priority(torrent_hash=None, file_ids=None, priority=None, **kwargs) None¶
Set priority for one or more files.
- Raises:
InvalidRequest400Error – if priority is invalid or at least one file ID is not an integer
Conflict409Error – if torrent metadata has not finished downloading or at least one file was not found
- Parameters:
- Return type:
- torrents_files(torrent_hash=None, **kwargs) TorrentFilesList¶
Retrieve individual torrent’s files.
- Raises:
- Parameters:
- Return type:
- torrents_increase_priority(torrent_hashes=None, **kwargs) None¶
Increase the priority of a torrent. Torrent Queuing must be enabled.
- torrents_info(status_filter=None, category=None, sort=None, reverse=None, limit=None, offset=None, torrent_hashes=None, tag=None, private=None, include_trackers=None, include_files=None, **kwargs) TorrentInfoList¶
Retrieves list of info for torrents.
- Parameters:
status_filter (
Literal['all','downloading','seeding','completed','paused','stopped','active','inactive','resumed','running','stalled','stalled_uploading','stalled_downloading','checking','moving','errored'] |None) –Filter list by torrent status:
Original options:
all,downloading,seeding,completed,paused,active,inactive,resumed,erroredAdded in Web API v2.4.1:
stalled,stalled_uploading, andstalled_downloadingAdded in Web API v2.8.4:
checkingAdded in Web API v2.8.18:
movingAdded in Web API v2.11.0:
stopped(replacedpaused),running(replacedresumed)
offset (
str|int|None) – Start of list (if < 0, offset from end of list)torrent_hashes (
str|Iterable[str] |None) – Filter list by hash (separate multiple hashes with a ‘|’) (added in Web API v2.0.1)tag (
str|None) – Filter list by tag (empty string means “untagged”; no “tag” parameter means “any tag”; added in Web API v2.8.3)private (
bool|None) – Filter list by private flag - use None to ignore; (added in Web API v2.11.1)include_trackers (
bool|None) – Include trackers in response; default False; (added in Web API v2.11.4)include_files (
bool|None) – Include files in response; default False; (added in Web API v2.11.7)
- Return type:
- torrents_parse_metadata(torrent_files=None, **kwargs) TorrentMetadataList¶
Parse the metadata of one or more torrent files without adding them.
This method was introduced with qBittorrent v5.2.0 (Web API v2.11.9).
- Raises:
UnsupportedMediaType415Error – if file is not a valid torrent file
TorrentFileNotFoundError – if a torrent file doesn’t exist
TorrentFilePermissionError – if read permission is denied to torrent file
- Parameters:
torrent_files (
TypeVar(TorrentFilesT,bytes,str,IO[bytes],Mapping[str,bytes|str|IO[bytes]],Iterable[bytes|str|IO[bytes]]) |None) – torrent files to parse; accepts the same values astorrents_add()- Return type:
- torrents_piece_availability(torrent_hash=None, **kwargs) TorrentPieceInfoList¶
Retrieve the number of copies of each piece available across all peers.
This method was introduced with qBittorrent v5.2.0 (Web API v2.15.1).
- Raises:
- Parameters:
- Return type:
- torrents_piece_hashes(torrent_hash=None, **kwargs) TorrentPieceInfoList¶
Retrieve individual torrent’s pieces’ hashes.
- Raises:
- Parameters:
- Return type:
- torrents_piece_states(torrent_hash=None, **kwargs) TorrentPieceInfoList¶
Retrieve individual torrent’s pieces’ states.
- Raises:
- Parameters:
- Return type:
- torrents_properties(torrent_hash=None, **kwargs) TorrentPropertiesDictionary¶
Retrieve individual torrent’s properties.
- Raises:
- Parameters:
- Return type:
- torrents_reannounce(torrent_hashes=None, urls=None, **kwargs) None¶
Reannounce a torrent.
This method was introduced with qBittorrent v4.1.2 (Web API v2.0.2).
- Parameters:
- Return type:
- torrents_remove_tags(tags=None, torrent_hashes=None, **kwargs) None¶
Add one or more tags to one or more torrents.
This method was introduced with qBittorrent v4.2.0 (Web API v2.3.0).
- torrents_remove_trackers(torrent_hash=None, urls=None, **kwargs) None¶
Remove trackers from a torrent.
This method was introduced with qBittorrent v4.1.4 (Web API v2.2.0).
- Raises:
- Parameters:
- Return type:
- torrents_remove_webseeds(torrent_hash=None, urls=None, **kwargs) None¶
Remove webseeds from a torrent.
- Raises:
InvalidRequest400Error – invalid URL
- Parameters:
- Return type:
- torrents_rename_file(torrent_hash=None, file_id=None, new_file_name=None, old_path=None, new_path=None, **kwargs) None¶
Rename a torrent file.
This method was introduced with qBittorrent v4.2.1 (Web API v2.4.0).
- Raises:
- Parameters:
- Return type:
- torrents_rename_folder(torrent_hash=None, old_path=None, new_path=None, **kwargs) None¶
Rename a torrent folder.
This method was introduced with qBittorrent v4.3.2 (Web API v2.7).
- Raises:
- Parameters:
- Return type:
- torrents_save_metadata(source=None, **kwargs) bytes¶
Export a .torrent file from previously fetched metadata.
This method was introduced with qBittorrent v5.2.0 (Web API v2.11.9).
The metadata must already have been retrieved with
torrents_fetch_metadata()ortorrents_parse_metadata().- Raises:
NotFound404Error – if
sourceis unknownConflict409Error – if metadata is not yet available
- Parameters:
source (
str|None) – URL (http://,https://,magnet:) or info hash- Return type:
- torrents_set_auto_management(enable=None, torrent_hashes=None, **kwargs) None¶
Enable or disable automatic torrent management for one or more torrents.
- torrents_set_category(category=None, torrent_hashes=None, **kwargs) None¶
Set a category for one or more torrents.
- torrents_set_comment(comment=None, torrent_hashes=None, **kwargs) None¶
Set a comment for one or more torrents.
- torrents_set_download_limit(limit=None, torrent_hashes=None, **kwargs) None¶
Set the download limit for one or more torrents.
- torrents_set_download_path(download_path=None, torrent_hashes=None, **kwargs) None¶
Set the Download Path for one or more torrents.
This method was introduced with qBittorrent v4.4.0 (Web API v2.8.4).
- Raises:
Forbidden403Error – cannot write to directory
Conflict409Error – cannot create directory
- Parameters:
- Return type:
- torrents_set_force_start(enable=None, torrent_hashes=None, **kwargs) None¶
Force start one or more torrents.
- torrents_set_location(location=None, torrent_hashes=None, **kwargs) None¶
Set location for torrents’ files.
- Raises:
Forbidden403Error – if the user doesn’t have permissions to write to the location (only before v4.5.2 - write check was removed.)
Conflict409Error – if the directory cannot be created at the location
- Parameters:
- Return type:
- torrents_set_save_path(save_path=None, torrent_hashes=None, **kwargs) None¶
Set the Save Path for one or more torrents.
This method was introduced with qBittorrent v4.4.0 (Web API v2.8.4).
- Raises:
Forbidden403Error – cannot write to directory
Conflict409Error – cannot create directory
- Parameters:
- Return type:
Set share limits for one or more torrents.
This method was introduced with qBittorrent v4.1.1 (Web API v2.0.1).
- Parameters:
torrent_hashes (
str|Iterable[str] |None) – single torrent hash or list of torrent hashes. Orallfor all torrents.ratio_limit (
str|float|None) – max ratio to seed a torrent. (-2 means use the global value and -1 is no limit)seeding_time_limit (
str|int|None) – minutes (-2 means use the global value and -1 is no limit)inactive_seeding_time_limit (
str|int|None) – minutes (-2 means use the global value and -1 is no limit) (added in Web API v2.9.2)share_limit_action (
Literal['Default','Stop','Remove','RemoveWithContent','EnableSuperSeeding'] |None) – action once share limit is reached. Options: Default, Stop, Remove, RemoveWithContent, EnableSuperSeeding (added in Web API v2.10.4)share_limits_mode (
Literal['Default','MatchAny','MatchAll'] |None) – mode once share limit is reached. Options: Default, MatchAny, MatchAll (added in Web API v2.16.0)
- Return type:
- torrents_set_ssl_parameters(torrent_hash=None, ssl_certificate=None, ssl_private_key=None, ssl_dh_params=None, **kwargs) None¶
Set the SSL parameters for an SSL torrent.
This method was introduced with qBittorrent v5.0.0 (Web API v2.10.3).
- Raises:
InvalidRequest400Error – if the SSL parameters are not valid
- Parameters:
- Return type:
- torrents_set_super_seeding(enable=None, torrent_hashes=None, **kwargs) None¶
Set one or more torrents as super seeding.
- torrents_set_tags(tags=None, torrent_hashes=None, **kwargs) None¶
Upsert one or more tags to one or more torrents.
Note: Tags that do not exist will be created on-the-fly.
This method was introduced with qBittorrent v5.1.0 (Web API v2.11.4).
- torrents_set_upload_limit(limit=None, torrent_hashes=None, **kwargs) None¶
Set the upload limit for one or more torrents.
- torrents_ssl_parameters(torrent_hash=None, **kwargs) TorrentSSLParametersDictionary¶
Retrieve the SSL parameters for an SSL torrent.
This method was introduced with qBittorrent v5.0.0 (Web API v2.10.3).
- Raises:
- Parameters:
- Return type:
- torrents_tags(**kwargs) TagList¶
Retrieve all tag definitions.
This method was introduced with qBittorrent v4.2.0 (Web API v2.3.0).
- Return type:
- torrents_toggle_first_last_piece_priority(torrent_hashes=None, **kwargs) None¶
Toggle priority of first/last piece downloading.
- torrents_toggle_sequential_download(torrent_hashes=None, **kwargs) None¶
Toggle sequential download for one or more torrents.
- torrents_top_priority(torrent_hashes=None, **kwargs) None¶
Set torrent as highest priority. Torrent Queuing must be enabled.
- torrents_trackers(torrent_hash=None, **kwargs) TrackersList¶
Retrieve individual torrent’s trackers. Tracker status is defined in
TrackerStatus.- Raises:
- Parameters:
- Return type:
- torrents_upload_limit(torrent_hashes=None, **kwargs) TorrentLimitsDictionary¶
Retrieve the upload limit for one or more torrents.
- torrents_webseeds(torrent_hash=None, **kwargs) WebSeedsList¶
Retrieve individual torrent’s web seeds.
- Raises:
NotFound404Error – torrent not found
- Parameters:
- Return type:
- class Torrents(client) None¶
Allows interaction with the
TorrentsAPI endpoints.- Usage:
>>> from qbittorrentapi import Client >>> client = Client(host="localhost:8080", username="admin", password="adminadmin") >>> # these are all the same attributes that are available as named in the >>> # endpoints or the more pythonic names in Client (with or without 'torrents_' prepended) >>> torrent_list = client.torrents.info() >>> torrent_list_active = client.torrents.info.active() >>> torrent_list_active_partial = client.torrents.info.active(limit=100, offset=200) >>> torrent_list_downloading = client.torrents.info.downloading() >>> # torrent looping >>> for torrent in client.torrents.info.completed() >>> # all torrents endpoints with a 'hashes' parameters support all method to apply action to all torrents >>> client.torrents.stop.all() >>> client.torrents.start.all() >>> # or specify the individual hashes >>> client.torrents.downloadLimit(torrent_hashes=["...", "..."])
- add(urls=None, torrent_files=None, save_path=None, cookie=None, category=None, is_skip_checking=None, is_paused=None, is_root_folder=None, rename=None, upload_limit=None, download_limit=None, use_auto_torrent_management=None, is_sequential_download=None, is_first_last_piece_priority=None, tags=None, content_layout=None, ratio_limit=None, seeding_time_limit=None, download_path=None, use_download_path=None, stop_condition=None, add_to_top_of_queue=None, inactive_seeding_time_limit=None, share_limit_action=None, ssl_certificate=None, ssl_private_key=None, ssl_dh_params=None, is_stopped=None, forced=None, file_priorities=None, downloader=None, share_limits_mode=None, **kwargs) str | TorrentsAddedMetadata¶
Implements
torrents_add().- Return type:
- add_trackers(torrent_hash=None, urls=None, **kwargs) None¶
Implements
torrents_add_trackers().- Return type:
- add_webseeds(torrent_hash=None, urls=None, **kwargs) None¶
Implements
torrents_add_webseeds().- Return type:
- count(**kwargs) int¶
Implements
torrents_count().- Return type:
- download_file(torrent_hash=None, file=None, **kwargs) str¶
Implements
torrents_download_file().- Return type:
- edit_tracker(torrent_hash=None, original_url=None, new_url=None, tier=None, **kwargs) None¶
Implements
torrents_edit_tracker().- Return type:
- edit_webseed(torrent_hash=None, orig_url=None, new_url=None, **kwargs) None¶
Implements
torrents_edit_webseed().- Return type:
- export(torrent_hash=None, **kwargs) bytes¶
Implements
torrents_export().- Return type:
- fetch_metadata(source=None, downloader=None, **kwargs) TorrentMetadataDictionary¶
Implements
torrents_fetch_metadata().- Return type:
- file_priority(torrent_hash=None, file_ids=None, priority=None, **kwargs) None¶
Implements
torrents_file_priority().- Return type:
- files(torrent_hash=None, **kwargs) TorrentFilesList¶
Implements
torrents_files().- Return type:
- parse_metadata(torrent_files=None, **kwargs) TorrentMetadataList¶
Implements
torrents_parse_metadata().- Return type:
- piece_availability(torrent_hash=None, **kwargs) TorrentPieceInfoList¶
Implements
torrents_piece_availability().- Return type:
- piece_hashes(torrent_hash=None, **kwargs) TorrentPieceInfoList¶
Implements
torrents_piece_hashes().- Return type:
- piece_states(torrent_hash=None, **kwargs) TorrentPieceInfoList¶
Implements
torrents_piece_states().- Return type:
- properties(torrent_hash=None, **kwargs) TorrentPropertiesDictionary¶
Implements
torrents_properties().- Return type:
- remove_trackers(torrent_hash=None, urls=None, **kwargs) None¶
Implements
torrents_remove_trackers().- Return type:
- remove_webseeds(torrent_hash=None, urls=None, **kwargs) None¶
Implements
torrents_remove_webseeds().- Return type:
- rename(torrent_hash=None, new_torrent_name=None, **kwargs) None¶
Implements
torrents_rename().- Return type:
- rename_file(torrent_hash=None, file_id=None, new_file_name=None, old_path=None, new_path=None, **kwargs) None¶
Implements
torrents_rename_file().- Return type:
- rename_folder(torrent_hash=None, old_path=None, new_path=None, **kwargs) None¶
Implements
torrents_rename_folder().- Return type:
- save_metadata(source=None, **kwargs) bytes¶
Implements
torrents_save_metadata().- Return type:
- set_ssl_parameters(torrent_hash=None, ssl_certificate=None, ssl_private_key=None, ssl_dh_params=None, **kwargs) None¶
Implements
torrents_set_ssl_parameters().- Return type:
- ssl_parameters(torrent_hash=None, **kwargs) TorrentSSLParametersDictionary¶
Implements
torrents_ssl_parameters().- Return type:
- trackers(torrent_hash=None, **kwargs) TrackersList¶
Implements
torrents_trackers().- Return type:
- webseeds(torrent_hash=None, **kwargs) WebSeedsList¶
Implements
torrents_webseeds().- Return type:
- class TorrentDictionary(data, client) None¶
Bases:
ClientCache[TorrentsAPIMixIn],ListEntryItem in
TorrentInfoList. Allows interaction with individual torrents via theTorrentsAPI endpoints.All torrent attributes are listed in https://github.com/qbittorrent/qBittorrent/blob/master/src/webui/api/serialize/serialize_torrent.h
- Usage:
>>> from qbittorrentapi import Client >>> client = Client(host="localhost:8080", username="admin", password="adminadmin") >>> # these are all the same attributes that are available as named in the >>> # endpoints or the more pythonic names in Client (with or without 'transfer_' prepended) >>> torrent = client.torrents.info()[0] >>> torrent_id = torrent.hash # truncated v2 hash or v1 hash >>> torrent_hash_v1 = torrent.infohash_v1 >>> torrent_hash_v2 = torrent.infohash_v2 >>> torrent_magnet = torrent.magnet_uri >>> torrent_name = torrent.name >>> # Attributes without inputs and a return value are properties >>> properties = torrent.properties >>> trackers = torrent.trackers >>> files = torrent.files >>> # Action methods >>> torrent.edit_tracker(original_url="...", new_url="...") >>> torrent.remove_trackers(urls="http://127.0.0.2/") >>> torrent.rename(new_torrent_name="...") >>> torrent.start() >>> torrent.stop() >>> torrent.recheck() >>> torrent.torrents_top_priority() >>> torrent.setLocation(location="/home/user/torrents/") >>> torrent.setCategory(category="video")
- add_tags(tags=None, **kwargs) None¶
Implements
torrents_add_tags().- Return type:
- add_trackers(urls=None, **kwargs) None¶
Implements
torrents_add_trackers().- Return type:
- add_webseeds(urls, **kwargs) None¶
Implements
torrents_add_webseeds().- Return type:
- bottom_priority(**kwargs) None¶
Implements
torrents_bottom_priority().- Return type:
- decrease_priority(**kwargs) None¶
Implements
torrents_decrease_priority().- Return type:
- delete(delete_files=None, **kwargs) None¶
Implements
torrents_delete().- Return type:
- download_file(file=None, **kwargs) str¶
Implements
torrents_download_file().- Return type:
- property download_limit: int¶
Implements
torrents_download_limit().
- edit_tracker(orig_url=None, new_url=None, tier=None, **kwargs) None¶
Implements
torrents_edit_tracker().- Return type:
- edit_webseed(orig_url=None, new_url=None, **kwargs) None¶
Implements
torrents_edit_webseed().- Return type:
- export(**kwargs) bytes¶
Implements
torrents_export().- Return type:
- file_priority(file_ids=None, priority=None, **kwargs) None¶
Implements
torrents_file_priority().- Return type:
- property files: TorrentFilesList¶
Implements
torrents_files().
- increase_priority(**kwargs) None¶
Implements
torrents_increase_priority().- Return type:
- property info: TorrentDictionary¶
Returns data from
torrents_info()for the torrent.
- pause(**kwargs) None¶
Implements
torrents_stop().- Return type:
- property piece_availability: TorrentPieceInfoList¶
Implements
torrents_piece_availability().
- property piece_hashes: TorrentPieceInfoList¶
Implements
torrents_piece_hashes().
- property piece_states: TorrentPieceInfoList¶
Implements
torrents_piece_states().
- property properties: TorrentPropertiesDictionary¶
Implements
torrents_properties().
- reannounce(urls=None, **kwargs) None¶
Implements
torrents_reannounce().- Return type:
- recheck(**kwargs) None¶
Implements
torrents_recheck().- Return type:
- remove_tags(tags=None, **kwargs) None¶
Implements
torrents_remove_tags().- Return type:
- remove_trackers(urls=None, **kwargs) None¶
Implements
torrents_remove_trackers().- Return type:
- remove_webseeds(urls=None, **kwargs) None¶
Implements
torrents_remove_webseeds().- Return type:
- rename(new_name=None, **kwargs) None¶
Implements
torrents_rename().- Return type:
- rename_file(file_id=None, new_file_name=None, old_path=None, new_path=None, **kwargs) None¶
Implements
torrents_rename_file().- Return type:
- rename_folder(old_path=None, new_path=None, **kwargs) None¶
Implements
torrents_rename_folder().- Return type:
- resume(**kwargs) None¶
Implements
torrents_start().- Return type:
- setComment(comment=None, **kwargs) None¶
Implements
torrents_set_comment().- Return type:
- set_auto_management(enable=None, **kwargs) None¶
Implements
torrents_set_auto_management().- Return type:
- set_category(category=None, **kwargs) None¶
Implements
torrents_set_category().- Return type:
- set_comment(comment=None, **kwargs) None¶
Implements
torrents_set_comment().- Return type:
- set_download_limit(limit=None, **kwargs) None¶
Implements
torrents_set_download_limit().- Return type:
- set_download_path(download_path=None, **kwargs) None¶
Implements
torrents_set_download_path().- Return type:
- set_force_start(enable=None, **kwargs) None¶
Implements
torrents_set_force_start().- Return type:
- set_location(location=None, **kwargs) None¶
Implements
torrents_set_location().- Return type:
- set_save_path(save_path=None, **kwargs) None¶
Implements
torrents_set_save_path().- Return type:
Implements
torrents_set_share_limits().- Return type:
- set_ssl_parameters(ssl_certificate=None, ssl_private_key=None, ssl_dh_params=None, **kwargs) None¶
Implements
torrents_set_ssl_parameters().- Return type:
- set_super_seeding(enable=None, **kwargs) None¶
Implements
torrents_set_super_seeding().- Return type:
- set_tags(tags=None, **kwargs) None¶
Implements
torrents_set_tags().- Return type:
- set_upload_limit(limit=None, **kwargs) None¶
Implements
torrents_set_upload_limit().- Return type:
- property ssl_parameters: TorrentSSLParametersDictionary¶
Implements
torrents_ssl_parameters().
- start(**kwargs) None¶
Implements
torrents_start().- Return type:
- property state_enum: TorrentState¶
Torrent state enum.
- stop(**kwargs) None¶
Implements
torrents_stop().- Return type:
- toggle_first_last_piece_priority(**kwargs) None¶
Implements
torrents_toggle_first_last_piece_priority().- Return type:
- toggle_sequential_download(**kwargs) None¶
Implements
torrents_toggle_sequential_download().- Return type:
- top_priority(**kwargs) None¶
Implements
torrents_top_priority().- Return type:
- property trackers: TrackersList¶
Implements
torrents_trackers().
- property upload_limit: int¶
Implements
torrents_upload_limit().
- property webseeds: WebSeedsList¶
Implements
torrents_webseeds().
- class TorrentCategories(*args, client, **kwargs)¶
Bases:
ClientCache[TorrentsAPIMixIn]Allows interaction with torrent categories within the
TorrentsAPI endpoints.- Usage:
>>> from qbittorrentapi import Client >>> client = Client(host="localhost:8080", username="admin", password="adminadmin") >>> # these are all the same attributes that are available as named in the >>> # endpoints or the more pythonic names in Client (with or without 'torrents_' prepended) >>> categories = client.torrent_categories.categories >>> # create or edit categories >>> client.torrent_categories.create_category(name="Video", save_path="/home/user/torrents/Video") >>> client.torrent_categories.edit_category(name="Video", save_path="/data/torrents/Video") >>> # edit or create new by assignment >>> client.torrent_categories.categories = dict(name="Video", save_path="/hone/user/") >>> # delete categories >>> client.torrent_categories.removeCategories(categories="Video") >>> client.torrent_categories.removeCategories(categories=["Audio", "ISOs"])
- property categories: TorrentCategoriesDictionary¶
Implements
torrents_categories().
- create_category(name=None, save_path=None, download_path=None, enable_download_path=None, **kwargs) None¶
Implements
torrents_create_category().- Return type:
- edit_category(name=None, save_path=None, download_path=None, enable_download_path=None, **kwargs) None¶
Implements
torrents_edit_category().- Return type:
- remove_categories(categories=None, **kwargs) None¶
Implements
torrents_remove_categories().- Return type:
- class TorrentTags(*args, client, **kwargs)¶
Bases:
ClientCache[TorrentsAPIMixIn]Allows interaction with torrent tags within the “Torrent” API endpoints.
- Usage:
>>> from qbittorrentapi import Client >>> client = Client(host="localhost:8080", username="admin", password="adminadmin") >>> tags = client.torrent_tags.tags >>> client.torrent_tags.tags = "tv show" # create category >>> client.torrent_tags.create_tags(tags=["tv show", "linux distro"]) >>> client.torrent_tags.delete_tags(tags="tv show")
- add_tags(tags=None, torrent_hashes=None, **kwargs) None¶
Implements
torrents_add_tags().- Return type:
- create_tags(tags=None, **kwargs) None¶
Implements
torrents_create_tags().- Return type:
- delete_tags(tags=None, **kwargs) None¶
Implements
torrents_delete_tags().- Return type:
- remove_tags(tags=None, torrent_hashes=None, **kwargs) None¶
Implements
torrents_remove_tags().- Return type:
- set_tags(tags=None, torrent_hashes=None, **kwargs) None¶
Implements
torrents_set_tags().- Return type:
- property tags: TagList¶
Implements
torrents_tags().
- class TorrentPropertiesDictionary(data=None, **kwargs)¶
Bases:
Dictionary[None|int|str|bool|Sequence[JsonValueT] |Mapping[str, JsonValueT]]Response to
torrents_properties()
- class TorrentLimitsDictionary(data=None, **kwargs)¶
Bases:
Dictionary[None|int|str|bool|Sequence[JsonValueT] |Mapping[str, JsonValueT]]Response to
torrents_download_limit()
- class TorrentCategoriesDictionary(data=None, **kwargs)¶
Bases:
Dictionary[None|int|str|bool|Sequence[JsonValueT] |Mapping[str, JsonValueT]]Response to
torrents_categories()
- class TorrentsAddPeersDictionary(data=None, **kwargs)¶
Bases:
Dictionary[None|int|str|bool|Sequence[JsonValueT] |Mapping[str, JsonValueT]]Response to
torrents_add_peers()
- class TorrentFilesList(list_entries, client=None)¶
Bases:
List[TorrentFile]Response to
torrents_files()
- class TorrentFile(data=None, **kwargs)¶
Bases:
ListEntryItem in
TorrentFilesList
- class WebSeedsList(list_entries, client=None)¶
-
Response to
torrents_webseeds()
- class WebSeed(data=None, **kwargs)¶
Bases:
ListEntryItem in
WebSeedsList
- class TrackersList(list_entries, client=None)¶
-
Response to
torrents_trackers()
- class Tracker(data=None, **kwargs)¶
Bases:
ListEntryItem in
TrackersList
- class TorrentInfoList(list_entries, client=None)¶
Bases:
List[TorrentDictionary]Response to
torrents_info()Definition: https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-5.0)#user-content-get-torrent-list
- class TorrentPieceInfoList(list_entries, client=None)¶
Bases:
List[TorrentPieceData]Response to
torrents_piece_states()andtorrents_piece_hashes()
- class TorrentPieceData(data=None, **kwargs)¶
Bases:
ListEntryItem in
TorrentPieceInfoList
- class TagList(list_entries, client=None)¶
-
Response to
torrents_tags()
- class TorrentsAddedMetadata(data=None, **kwargs)¶
Bases:
Dictionary[Any]Response to
torrents_add()for API v2.14.0+
- class TorrentSSLParametersDictionary(data=None, **kwargs)¶
Bases:
Dictionary[str]Response to
torrents_ssl_parameters()
- class TorrentMetadataDictionary(data=None, **kwargs)¶
Bases:
ListEntryResponse to
torrents_fetch_metadata()
- class TorrentMetadataList(list_entries, client=None)¶
Bases:
List[TorrentMetadataDictionary]Response to
torrents_parse_metadata()