Skip to main content

Simple Deluge Client

Project description

https://ci.appveyor.com/api/projects/status/8s3g4uucg2xcay6v/branch/develop?svg=true

A lightweight pure-python rpc client for deluge. Note, does not support events and any additional replies from deluge will mess up the datastream.

Requirements

  • Deluge 1.3.x, 2.0 beta

  • Python 2.7, 3.4, 3.5, 3.6

Install

From GitHub (develop):

pip install git+https://github.com/JohnDoee/deluge-client.git#develop

From PyPi (stable):

pip install deluge-client

Usage

>>> from deluge_client import DelugeRPCClient

>>> client = DelugeRPCClient('127.0.0.1', 12345, 'username', 'password')
>>> client.connect()
>>> client.connected
True
>>> client.call('core.get_torrents_status', {}, ['name'])
{'79816060ea56d56f2a2148cd45705511079f9bca': {'name': 'TPB.AFK.2013.720p.h264-SimonKlose'}}
>>> client.core.get_torrents_status({}, ['name'])
{'79816060ea56d56f2a2148cd45705511079f9bca': {'name': 'TPB.AFK.2013.720p.h264-SimonKlose'}}

Idiom to use for automatic reconnect where the daemon might be offline at call time.

import time

from deluge_client import DelugeRPCClient, FailedToReconnectException

def call_retry(client, method, *args, **kwargs):
    # We will only try the command 10 times
    for _ in range(10):
        try:
            return client.call(method, *args, **kwargs)
        except FailedToReconnectException:
            # 5 second delay between calls
            time.sleep(5)

Idiom usage

client = DelugeRPCClient('127.0.0.1', 58846, 'username', 'password', automatic_reconnect=True)
# The client has to be online when you start the process,
# otherwise you must handle that yourself.
client.connect()
call_retry(client, 'core.get_torrents_status', {}, ['name'])

License

MIT, see LICENSE

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-client-1.7.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deluge_client-1.7.0-py2.py3-none-any.whl (11.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file deluge-client-1.7.0.tar.gz.

File metadata

  • Download URL: deluge-client-1.7.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for deluge-client-1.7.0.tar.gz
Algorithm Hash digest
SHA256 7c2bb6baa3183f039125fc490f47f8c6699312c3e69fcada89e9e70f63c6e092
MD5 70a00171401cb400252c4ebc60b0c0ad
BLAKE2b-256 aa0676878d5a7d3b1c92e524b0f539f7b1ba1d73848a0e5f6d7864a70ce8ac72

See more details on using hashes here.

File details

Details for the file deluge_client-1.7.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for deluge_client-1.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 69eedaf787110be918500ff92990a08b296ec3dbba739e43571c3e2f878120f6
MD5 8cc81ba4127e3e0231683f9fbe302dc3
BLAKE2b-256 5159d020e04dd55ef8839d5edea878b6ea68b19e764daa288c28c789ce8a7c69

See more details on using hashes here.

Supported by

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