Skip to content

[fix] Show reasonable error if login to to torrentleech.org fails#2256

Merged
gazpachoking merged 2 commits intoFlexget:developfrom
carlba:bugfix/torrentleach_detect_failed_login
Nov 21, 2018
Merged

[fix] Show reasonable error if login to to torrentleech.org fails#2256
gazpachoking merged 2 commits intoFlexget:developfrom
carlba:bugfix/torrentleach_detect_failed_login

Conversation

@carlba
Copy link
Copy Markdown
Contributor

@carlba carlba commented Nov 20, 2018

Motivation for changes

The torrentleech plugin didn't detect if tbe login to the torrentleech site failed. Instead it failed on every attempt to search for a series or movie with a JSON Decode error.

Detailed changes

Check if the url of the response still has the login part in it and raise an exception in this case.

- A Dubious JSON error was shown if the login failed
@carlba carlba changed the title Show reasonable error if login to to torrentleech.org fails [fix] Show reasonable error if login to to torrentleech.org fails Nov 20, 2018
except RequestException as e:
raise PluginError('Could not connect to torrentleech: %s' % str(e))

if login.url.endswith(u'/user/account/login/'):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the u is really necessary

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. String literals are unicode by default on both python 2 (because we import unicode_literals from __future__) and python 3.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just old habit I will remove it :)

@gazpachoking gazpachoking merged commit 39ddab6 into Flexget:develop Nov 21, 2018
@gazpachoking
Copy link
Copy Markdown
Member

Thanks!

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.

3 participants