Introducing DelugeWebClient

Suggest, post, or discuss plugins for Deluge
Post Reply
jlw_4049
New User
New User
Posts: 5
Joined: Fri Aug 19, 2022 5:52 pm

Introducing DelugeWebClient

Post by jlw_4049 »

What My Project Does

I needed a way to inject torrents into Deluge bittorrent client via Python for a few projects.

Comparison

Initially, I was using the deluge-client, which worked well but had a key limitation: it doesn't support HTTP connections, making it incompatible with setups using reverse proxies.

Given this limitation and my need for HTTP support, I decided to create my own solution. While the original goal was to make a utility for personal use, I realized others might benefit from it as well, so I expanded it into a more polished tool for the community.

Target Audience

Anyone that would like to utilize python to interact with their Deluge bittorrent client.

DelugeWebClient

A Python client for the Deluge Web API, with support for HTTP connections, making it ideal for reverse proxy setups or direct URL access.

Key Features

Full access to most Deluge Web API methods, including core functionalities through RPC. Designed for use in projects where HTTP connections are essential. Easy to integrate and use, with a clear API and support for common tasks like uploading torrents and managing torrents. I took inspiration from qbittorrent-api, and I hope this project proves helpful to anyone looking for a flexible, HTTP-capable Deluge Web API client.

Feedback and Contributions Feel free to try it out, give feedback, report any issues, or contribute on GitHub. Any suggestions or contributions to make it better are welcome!

Example Usage

Code: Select all

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)
Links
Project

PyPi

Docs
User avatar
ambipro
Moderator
Moderator
Posts: 672
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Introducing DelugeWebClient

Post by ambipro »

Very cool! Nice to see someone else doing some API related stuff and opening things up!

Not trying to steal your thunder here, but I wrote a class for the JSON-RPC end point too, if you want to take anything from it feel free.

I don't publish to PyPi or anything, and don't intend to take it there, but just thought perhaps it might be fun for you to compare notes with mine, it is by no means meant to be a module or anything though. Just a quick little class to get certain automated tasks done :P

https://github.com/zakkarry/deluge-move ... y#L73-L131

Very nice to see this being available - as it allows non-RPC users (for example seedboxes that do not have open ports other than webui's) able to utilize the methods.

I'm not sure this really belongs in Off Topic though, probably development or plugins (I'd say plugins might be best as the traffic there would get you exposure) - if you'd like me to move the thread let me know.

Edit: Just looked at your code briefly, and you're definitely fine without me, so keep up the good work :P Just wanted to chip in if I could. :D
jlw_4049
New User
New User
Posts: 5
Joined: Fri Aug 19, 2022 5:52 pm

Re: Introducing DelugeWebClient

Post by jlw_4049 »

Very cool! Nice to see someone else doing some API related stuff and opening things up!

Not trying to steal your thunder here, but I wrote a class for the JSON-RPC end point too, if you want to take anything from it feel free.

I don't publish to PyPi or anything, and don't intend to take it there, but just thought perhaps it might be fun for you to compare notes with mine, it is by no means meant to be a module or anything though. Just a quick little class to get certain automated tasks done :P

https://github.com/zakkarry/deluge-move ... y#L73-L131
Oh interesting. I took a look at your code, thanks for sharing it! Initially, when I wrote this I was just going to write up a script I needed since what was available wasn't working for my use case. As I continued writing it, I was like, eh I might as well make it something more people can use. :D
Very nice to see this being available - as it allows non-RPC users (for example seedboxes that do not have open ports other than webui's) able to utilize the methods.

I'm not sure this really belongs in Off Topic though, probably development or plugins (I'd say plugins might be best as the traffic there would get you exposure) - if you'd like me to move the thread let me know.

Edit: Just looked at your code briefly, and you're definitely fine without me, so keep up the good work :P Just wanted to chip in if I could. :D
Agreed, anything HTTP will work. Like you stated, it works well for seedbox's, localhost, local network, reverse proxy, etc. Feel free to move this to the proper place!! Thank you.

Also, feel free to contribute!

I also followed you on git and looked at some of your repos!
User avatar
ambipro
Moderator
Moderator
Posts: 672
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Introducing DelugeWebClient

Post by ambipro »

Thanks for the follow! I'll return it. I have some cool projects for the torrent/automation community I'm a part of in addition to Deluge, if you check them out and have any questions or anything you can PM me or find me on our Discord (https://discord.gg/X6yhJE6ZTr) which is linked to our IRC.

I'll take a more in-depth look at your code here soon. Excited to see another approach :)

Moved to plugins for you :)
jlw_4049
New User
New User
Posts: 5
Joined: Fri Aug 19, 2022 5:52 pm

Re: Introducing DelugeWebClient

Post by jlw_4049 »

Thanks for the suggestions/help, I appreciate it! I joined the discord as well. Sent you a FR on discord too.
User avatar
ambipro
Moderator
Moderator
Posts: 672
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Introducing DelugeWebClient

Post by ambipro »

Glad to have you in the community and appreciate you contributing too!
Post Reply