JohnDoee / deluge-client

A very lightweight pure-python Deluge RPC Client
MIT License
87 stars 14 forks source link

Fix context manager - return the client upon enter #35

Closed bozhodimitrov closed 4 years ago

bozhodimitrov commented 4 years ago

The magic method that should return self is the enter one and not the exit one. Cheers and thanks for creating this project!

JohnDoee commented 4 years ago

Thanks for fixing it, it'll be out with 1.8.1 which I release when tests are done.

bozhodimitrov commented 4 years ago

Can i backport one more thing from synchronous deluge, before you release? It is the automatic connection to a local Deluge instance.

client = DelugeRPCClient() # don't pass username/password
client.connect() # connects to your local instance with the username and password created by Deluge itself
JohnDoee commented 4 years ago

Sure

JohnDoee commented 4 years ago

I'm not sure I want that directly in the library but would be happy to have it as an example. To me it feels like directly integrating it would increase edge-cases and complexity of maintaining it.

You can see the basic logic for Linux here https://github.com/JohnDoee/autotorrent/blob/develop/autotorrent/clients/deluge.py#L57-L101 which works much the same way as Deluge GTK.

bozhodimitrov commented 4 years ago

Yea, I know exactly what you mean. I also hate maintaining messy code. This is why I am trying to make it more readable and error prune at the moment.

bozhodimitrov commented 4 years ago

@JohnDoee what do you think of this change: Add automatic login for local Deluge instances

Sorry for hijacking this PR with offtopic, but I don't want to spam you with new Issues/PRs without a reason.