Catch xbmc turned off error

This commit is contained in:
Ruud
2014-01-15 21:51:27 +01:00
parent 6cc802952f
commit 5ea13eeffd

View File

@@ -8,6 +8,7 @@ import socket
import traceback
import urllib
import requests
from requests.packages.urllib3.exceptions import MaxRetryError
log = CPLog(__name__)
@@ -168,7 +169,7 @@ class XBMC(Notification):
# manually fake expected response array
return [{'result': 'Error'}]
except requests.exceptions.Timeout:
except (MaxRetryError, requests.exceptions.Timeout):
log.info2('Couldn\'t send request to XBMC, assuming it\'s turned off')
return [{'result': 'Error'}]
except:
@@ -203,7 +204,7 @@ class XBMC(Notification):
log.debug('Returned from request %s: %s', (host, response))
return response
except requests.exceptions.Timeout:
except (MaxRetryError, requests.exceptions.Timeout):
log.info2('Couldn\'t send request to XBMC, assuming it\'s turned off')
return []
except: