<div align="center">
# Deluge Web API Client
![PyPI Version](https://img.shields.io/pypi/v/deluge-web-client)
![Python Versions](https://img.shields.io/pypi/pyversions/deluge-web-client)
![License](https://img.shields.io/github/license/jessielw/deluge-web-client)
[![Mypy](https://github.com/jessielw/deluge-web-client/actions/workflows/mypy.yml/badge.svg)](https://github.com/jessielw/deluge-web-client/actions/workflows/mypy.yml)
[![PyPI](https://github.com/jessielw/deluge-web-client/actions/workflows/python_publish.yml/badge.svg)](https://github.com/jessielw/deluge-web-client/actions/workflows/python_publish.yml)
[![Ruff](https://github.com/jessielw/deluge-web-client/actions/workflows/ruff.yml/badge.svg)](https://github.com/jessielw/deluge-web-client/actions/workflows/ruff.yml)
[![codecov](https://codecov.io/github/jessielw/deluge-web-client/graph/badge.svg?token=TQQQ0NOG5F)](https://codecov.io/github/jessielw/deluge-web-client)
Python client implementation for [Deluge](https://deluge-torrent.org/) Web API
</div>
User Guide and API Reference available on [Read the Docs](https://deluge-web-client.readthedocs.io).
## Features
- Provides access to the majority of Web API methods as well as key **core** functionalities through RPC. For more details, see the official [Web API Documentation](https://deluge.readthedocs.io/en/deluge-2.0.1/reference/webapi.html) and [RPC API Documentation](https://deluge.readthedocs.io/en/deluge-2.0.1/reference/api.html).
- Allows you to use direct **http** connections, allowing access via **reverse proxy** or any **direct url**.
## Installation
Install via pip from [PyPI](https://pypi.org/project/deluge-web-client/):
```bash
python -m pip install deluge-web-client
# or
poetry add deluge-web-client
```
## Getting Started
Before getting started, ensure that you have a running instance of Deluge with the WebUI enabled. You will also need to have a user set up for authentication. For guidance on setting up the WebUI, visit the [Deluge setup guide](https://deluge-torrent.org/userguide/). Another good tutorial is [Trash-Guides basic setup](https://trash-guides.info/Downloaders/Deluge/Basic-Setup/).
## Basic Usage
```python
from deluge_web_client import DelugeWebClient
# instantiate a client
client = DelugeWebClient(url="https://site.net/deluge", password="example_password")
# login
# once logged in the `client` will maintain the logged in state as long as you don't call
# client.disconnect()
client.login()
# upload a torrent
upload = client.upload_torrent(
torrent_path="filepath.torrent",
add_paused=False, # optional
seed_mode=False, # optional
auto_managed=False, # optional
save_directory=None, # optional
label=None, # optional
)
# this will return a `Response` object
print(upload)
# Response(result=True, error=None, id=1)
# retrieve and show all torrents
all_torrents = client.get_torrents_status()
# pause torrent (pass torrent hash)
pause_torrent = client.pause_torrent("0407326f9d74629d299b525bd5f9b5dd583xxxx")
# remove torrent
remove_torrent = client.remove_torrent("0407326f9d74629d299b525bd5f9b5dd583xxxx")
```
## Context Manager
```python
from deluge_web_client import DelugeWebClient
# using a context manager automatically logs you in
with DelugeWebClient(url="https://site.net/deluge", password="example_password") as client:
upload = client.upload_torrent(
torrent_path="filepath.torrent",
add_paused=False, # optional
seed_mode=False, # optional
auto_managed=False, # optional
save_directory=None, # optional
label=None, # optional
)
print(upload)
# Response(result="0407326f9d74629d299b525bd5f9b5dd583xxxx", error=None, id=1)
```
## Notes
Calling `client.disconnect()` will log the user out of the WebUI in both the client and **any connected web browser**. Be cautious if you're also logged in to the WebUI via your browser as this will terminate your session there as well.
## Access RPC Directly
This package uses HTTP to connect to the Deluge client, relying on the **Web API / JSON** to handle these calls. It's fully capable of making **all** core calls to the Deluge backend. However, if you are looking for a package focused solely on **RPC**, consider [deluge-client](https://github.com/JohnDoee/deluge-client), which served as inspiration for this project alongside [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api).
Raw data
{
"_id": null,
"home_page": null,
"name": "deluge-web-client",
"maintainer": "jlw_4049",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "jessielw4049@gmail.com",
"keywords": "python, deluge, api, client, torrent, torrents, webui, web",
"author": "jlw_4049",
"author_email": "jessielw4049@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f4/26/6b3533210adaf93a506db8f99df3588db82460c2eacb4c36e54def6b8865/deluge_web_client-1.0.4.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n# Deluge Web API Client\n\n![PyPI Version](https://img.shields.io/pypi/v/deluge-web-client)\n![Python Versions](https://img.shields.io/pypi/pyversions/deluge-web-client)\n![License](https://img.shields.io/github/license/jessielw/deluge-web-client)\n[![Mypy](https://github.com/jessielw/deluge-web-client/actions/workflows/mypy.yml/badge.svg)](https://github.com/jessielw/deluge-web-client/actions/workflows/mypy.yml)\n[![PyPI](https://github.com/jessielw/deluge-web-client/actions/workflows/python_publish.yml/badge.svg)](https://github.com/jessielw/deluge-web-client/actions/workflows/python_publish.yml)\n[![Ruff](https://github.com/jessielw/deluge-web-client/actions/workflows/ruff.yml/badge.svg)](https://github.com/jessielw/deluge-web-client/actions/workflows/ruff.yml)\n[![codecov](https://codecov.io/github/jessielw/deluge-web-client/graph/badge.svg?token=TQQQ0NOG5F)](https://codecov.io/github/jessielw/deluge-web-client)\n\nPython client implementation for [Deluge](https://deluge-torrent.org/) Web API\n\n</div>\n\nUser Guide and API Reference available on [Read the Docs](https://deluge-web-client.readthedocs.io).\n\n## Features\n\n- Provides access to the majority of Web API methods as well as key **core** functionalities through RPC. For more details, see the official [Web API Documentation](https://deluge.readthedocs.io/en/deluge-2.0.1/reference/webapi.html) and [RPC API Documentation](https://deluge.readthedocs.io/en/deluge-2.0.1/reference/api.html).\n\n- Allows you to use direct **http** connections, allowing access via **reverse proxy** or any **direct url**.\n\n## Installation\n\nInstall via pip from [PyPI](https://pypi.org/project/deluge-web-client/):\n\n```bash\npython -m pip install deluge-web-client\n# or\npoetry add deluge-web-client\n```\n\n## Getting Started\n\nBefore getting started, ensure that you have a running instance of Deluge with the WebUI enabled. You will also need to have a user set up for authentication. For guidance on setting up the WebUI, visit the [Deluge setup guide](https://deluge-torrent.org/userguide/). Another good tutorial is [Trash-Guides basic setup](https://trash-guides.info/Downloaders/Deluge/Basic-Setup/).\n\n## Basic Usage\n\n```python\nfrom deluge_web_client import DelugeWebClient\n\n# instantiate a client\nclient = DelugeWebClient(url=\"https://site.net/deluge\", password=\"example_password\")\n\n# login\n# once logged in the `client` will maintain the logged in state as long as you don't call\n# client.disconnect()\nclient.login()\n\n# upload a torrent\nupload = client.upload_torrent(\n torrent_path=\"filepath.torrent\",\n add_paused=False, # optional\n seed_mode=False, # optional\n auto_managed=False, # optional\n save_directory=None, # optional\n label=None, # optional\n)\n# this will return a `Response` object\nprint(upload)\n# Response(result=True, error=None, id=1)\n\n# retrieve and show all torrents\nall_torrents = client.get_torrents_status()\n\n# pause torrent (pass torrent hash)\npause_torrent = client.pause_torrent(\"0407326f9d74629d299b525bd5f9b5dd583xxxx\")\n\n# remove torrent\nremove_torrent = client.remove_torrent(\"0407326f9d74629d299b525bd5f9b5dd583xxxx\")\n```\n\n## Context Manager\n\n```python\nfrom deluge_web_client import DelugeWebClient\n\n# using a context manager automatically logs you in\nwith DelugeWebClient(url=\"https://site.net/deluge\", password=\"example_password\") as client:\n upload = client.upload_torrent(\n torrent_path=\"filepath.torrent\",\n add_paused=False, # optional\n seed_mode=False, # optional\n auto_managed=False, # optional\n save_directory=None, # optional\n label=None, # optional\n )\n print(upload)\n # Response(result=\"0407326f9d74629d299b525bd5f9b5dd583xxxx\", error=None, id=1)\n```\n\n## Notes\n\nCalling `client.disconnect()` will log the user out of the WebUI in both the client and **any connected web browser**. Be cautious if you're also logged in to the WebUI via your browser as this will terminate your session there as well.\n\n## Access RPC Directly\n\nThis package uses HTTP to connect to the Deluge client, relying on the **Web API / JSON** to handle these calls. It's fully capable of making **all** core calls to the Deluge backend. However, if you are looking for a package focused solely on **RPC**, consider [deluge-client](https://github.com/JohnDoee/deluge-client), which served as inspiration for this project alongside [qbittorrent-api](https://github.com/rmartin16/qbittorrent-api).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Deluge Web Client",
"version": "1.0.4",
"project_urls": null,
"split_keywords": [
"python",
" deluge",
" api",
" client",
" torrent",
" torrents",
" webui",
" web"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1c39984d81d58c93e98d46b8c4b508bea154f6b87a773ba6ff673815d1d0f397",
"md5": "05e916a8bfab0402812adc6a722da098",
"sha256": "ba588aacf5822b9f9040ab11b854bbb1a98041cc090e860ff4005d7706f2684c"
},
"downloads": -1,
"filename": "deluge_web_client-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "05e916a8bfab0402812adc6a722da098",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 9783,
"upload_time": "2024-10-08T00:49:06",
"upload_time_iso_8601": "2024-10-08T00:49:06.624110Z",
"url": "https://files.pythonhosted.org/packages/1c/39/984d81d58c93e98d46b8c4b508bea154f6b87a773ba6ff673815d1d0f397/deluge_web_client-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f4266b3533210adaf93a506db8f99df3588db82460c2eacb4c36e54def6b8865",
"md5": "2bdd5d9a350b72cfe4d9b8c6d5deb2ac",
"sha256": "3637b22d2749e6b02cd48098262d3f805eefc889590cac69bb9f22ef7fa0a731"
},
"downloads": -1,
"filename": "deluge_web_client-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "2bdd5d9a350b72cfe4d9b8c6d5deb2ac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9917,
"upload_time": "2024-10-08T00:49:07",
"upload_time_iso_8601": "2024-10-08T00:49:07.761153Z",
"url": "https://files.pythonhosted.org/packages/f4/26/6b3533210adaf93a506db8f99df3588db82460c2eacb4c36e54def6b8865/deluge_web_client-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-08 00:49:07",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "deluge-web-client"
}