Catch trakt errors
This commit is contained in:
@@ -41,13 +41,19 @@ class Trakt(Automation):
|
|||||||
|
|
||||||
def call(self, method_url):
|
def call(self, method_url):
|
||||||
|
|
||||||
if self.conf('automation_password'):
|
try:
|
||||||
headers = {
|
if self.conf('automation_password'):
|
||||||
'Authorization': 'Basic %s' % base64.encodestring('%s:%s' % (self.conf('automation_username'), self.conf('automation_password')))[:-1]
|
headers = {
|
||||||
}
|
'Authorization': 'Basic %s' % base64.encodestring('%s:%s' % (self.conf('automation_username'), self.conf('automation_password')))[:-1]
|
||||||
else:
|
}
|
||||||
headers = {}
|
else:
|
||||||
|
headers = {}
|
||||||
|
|
||||||
cache_key = 'trakt.%s' % md5(method_url)
|
cache_key = 'trakt.%s' % md5(method_url)
|
||||||
json_string = self.getCache(cache_key, self.urls['base'] + method_url, headers = headers)
|
json_string = self.getCache(cache_key, self.urls['base'] + method_url, headers = headers)
|
||||||
return json.loads(json_string)
|
if json_string:
|
||||||
|
return json.loads(json_string)
|
||||||
|
except:
|
||||||
|
log.error('Failed to get data from trakt, check your login.')
|
||||||
|
|
||||||
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user