Skip to main content

Deluge Web Client

Project description

Deluge Web API Client

PyPI Version Python Versions License

Python client implementation for Deluge Web API

User Guide and API Reference available on Read the Docs.

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 and RPC API Documentation.

  • Allows you to use direct http connections, allowing access via reverse proxy or any direct url.

Installation

Install via pip from PyPI:

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. Another good tutorial is Trash-Guides basic setup.

Basic Usage

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

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, which served as inspiration for this project alongside qbittorrent-api.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deluge_web_client-1.0.3.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

deluge_web_client-1.0.3-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file deluge_web_client-1.0.3.tar.gz.

File metadata

  • Download URL: deluge_web_client-1.0.3.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for deluge_web_client-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1f23a84793b4980002047ae21685c68e663102313b8cb3136355ea55b131640d
MD5 2cabced11e711ee4ab0f5a7bb8d999f1
BLAKE2b-256 b79fdc09736c6912800769527666604e2af56783631b03358603c0fad1d1d995

See more details on using hashes here.

File details

Details for the file deluge_web_client-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for deluge_web_client-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d0a51a8054db74fcea0f2306e2eb75a9a90adb65320929254bad3a296adddad3
MD5 db6b87d530525ce7d8b999c99ea439f2
BLAKE2b-256 64d1ed3d7c1a37fb70e45e1dbce1c307e6353cc0e8dcd080580f371640863ed4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page