Private GIT

Skip to content
Snippets Groups Projects
Commit 318239e4 authored by miigotu's avatar miigotu
Browse files

Merge pull request #2225 from SiCKRAGETV/fix-trakt-catch

Fix equality vs identity problem in catching requests status codes fo…
parents e8488e5d 7227f4a1
No related branches found
No related tags found
No related merge requests found
...@@ -98,11 +98,11 @@ class TraktAPI(): ...@@ -98,11 +98,11 @@ class TraktAPI():
# It means there basically was no response at all # It means there basically was no response at all
else: else:
logger.log(u'Could not connect to Trakt. Error: {0}'.format(e), logger.WARNING) logger.log(u'Could not connect to Trakt. Error: {0}'.format(e), logger.WARNING)
elif code is 502: elif code == 502:
# Retry the request, cloudflare had a proxying issue # Retry the request, cloudflare had a proxying issue
logger.log(u'Retrying trakt api request: %s' % path, logger.WARNING) logger.log(u'Retrying trakt api request: %s' % path, logger.WARNING)
return self.traktRequest(path, data, headers, url, method) return self.traktRequest(path, data, headers, url, method)
elif code is 401: elif code == 401:
if self.traktToken(refresh=True, count=count): if self.traktToken(refresh=True, count=count):
return self.traktRequest(path, data, headers, url, method) return self.traktRequest(path, data, headers, url, method)
else: else:
...@@ -110,7 +110,7 @@ class TraktAPI(): ...@@ -110,7 +110,7 @@ class TraktAPI():
elif code in (500,501,503,504,520,521,522): elif code in (500,501,503,504,520,521,522):
#http://docs.trakt.apiary.io/#introduction/status-codes #http://docs.trakt.apiary.io/#introduction/status-codes
logger.log(u'Trakt may have some issues and it\'s unavailable. Try again later please', logger.WARNING) logger.log(u'Trakt may have some issues and it\'s unavailable. Try again later please', logger.WARNING)
elif code is 404: elif code == 404:
logger.log(u'Trakt error (404) the resource does not exist: %s' % url + path, logger.WARNING) logger.log(u'Trakt error (404) the resource does not exist: %s' % url + path, logger.WARNING)
else: else:
logger.log(u'Could not connect to Trakt. Code error: {0}'.format(code), logger.ERROR) logger.log(u'Could not connect to Trakt. Code error: {0}'.format(code), logger.ERROR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment