Catch trakt errors

This commit is contained in:
Ruud committed 2012-06-12 20:11:16 +02:00
1 parent ad2126467a
commit aba9d57439
1 file changed
+6
@@ -41,6 +41,7 @@ class Trakt(Automation):
def call(self, method_url): def call(self, method_url):
try:
if self.conf('automation_password'): if self.conf('automation_password'):
headers = { headers = {
'Authorization': 'Basic %s' % base64.encodestring('%s:%s' % (self.conf('automation_username'), self.conf('automation_password')))[:-1] 'Authorization': 'Basic %s' % base64.encodestring('%s:%s' % (self.conf('automation_username'), self.conf('automation_password')))[:-1]
@@ -50,4 +51,9 @@ class Trakt(Automation):
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)
if json_string:
return json.loads(json_string) return json.loads(json_string)
except:
log.error('Failed to get data from trakt, check your login.')
return []