From 71ec47ae6b7e8d817e45b90ec9845f5fe5f99e01 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 27 Apr 2014 17:08:12 -0700 Subject: [PATCH] Fix for error code checking for Newznab providers. --- sickbeard/providers/newznab.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 8498ea7e..9805da82 100644 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -161,20 +161,20 @@ class NewznabProvider(generic.NZBProvider): if data is None: return self._checkAuth() - if 'status' in data: - if data.status in [200, 301]: - return True - if data.status == 100: - raise AuthException("Your API key for " + self.name + " is incorrect, check your config.") - elif data.status == 101: - raise AuthException("Your account on " + self.name + " has been suspended, contact the administrator.") - elif data.status == 102: - raise AuthException( - "Your account isn't allowed to use the API on " + self.name + ", contact the administrator") - else: - logger.log(u"Unknown error given from " + self.name + ": " + data.feed.title, - logger.ERROR) - return False + if len(data.feed) > 0: + if 'error' in data.feed: + if data.feed.error == 100: + raise AuthException("Your API key for " + self.name + " is incorrect, check your config.") + elif data.feed.error == 101: + raise AuthException("Your account on " + self.name + " has been suspended, contact the administrator.") + elif data.feed.error == 102: + raise AuthException( + "Your account isn't allowed to use the API on " + self.name + ", contact the administrator") + else: + logger.log(u"Unknown error given from " + self.name + ": " + data.feed.title, + logger.ERROR) + return False + return True def _doSearch(self, search_params, show=None, max_age=0):