Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save location endpoint #26

Closed

Conversation

alex-phillips
Copy link

added function to set torrents save location

@EhsanKia
Copy link

Thanks for this! I started using this library to update my torrent locations, only to realize it didn't have that endpoint. Manually patched locally, but would love to see this merged!

@EhsanKia
Copy link

EhsanKia commented Jun 15, 2019

Hmm, it seems like spaces aren't handled properly, at least on windows. They're converted to +'s, Investigating at which step they are urlencoded/decoded.

EDIT: Yep, looking at the webclient, it urlencodes it before sending, so spaces become %20 instead of +.
For now I will encode on my end, but maybe you could update your code to call urllib.quote()? Though it's urllib.parse.quote() in py3.

EDIT2: Actually, encoding before doesn't work because requests reencodes it, ending up with double encoded params. The issue is that requests uses urllib.quote_plus, which uses + for spaces instead of %20, and qbittorrent doesn't handle that well.

There's unfortunately no way of telling requests to use quote instead of quote_plus when you pass a dict, so the only option is to pre-encode your data before sending it in. But even that is tricky. In py3, there's urllib.parse.urlencode(params, quote_via=urllib.parse.quote), but py2 doesn't have that.
the very hacky solution is to replace quote_plus with urllib.quote_plus = urllib.quote.

@v1k45
Copy link
Owner

v1k45 commented Jan 18, 2020

Closing because this change is not compatible with 4.1x. Thanks for your contribution.

@v1k45 v1k45 closed this Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants