1
0
mirror of https://github.com/moparisthebest/SickRage synced 2025-01-05 19:08:02 -05:00

Added exception catching for timeouts to notifiers

This commit is contained in:
echel0n 2014-09-06 17:51:44 -07:00
parent 65eda93b2b
commit 6ce43c7782
3 changed files with 7 additions and 5 deletions

View File

@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>. # along with SickRage. If not, see <http://www.gnu.org/licenses/>.
import socket
from httplib import HTTPSConnection, HTTPException from httplib import HTTPSConnection, HTTPException
from urllib import urlencode from urllib import urlencode
@ -87,7 +88,7 @@ class ProwlNotifier:
"/publicapi/add", "/publicapi/add",
headers={'Content-type': "application/x-www-form-urlencoded"}, headers={'Content-type': "application/x-www-form-urlencoded"},
body=urlencode(data)) body=urlencode(data))
except (SSLError, HTTPException): except (SSLError, HTTPException, socket.error):
logger.log(u"Prowl notification failed.", logger.ERROR) logger.log(u"Prowl notification failed.", logger.ERROR)
return False return False
response = http_handler.getresponse() response = http_handler.getresponse()

View File

@ -17,6 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>. # along with SickRage. If not, see <http://www.gnu.org/licenses/>.
import socket
from httplib import HTTPSConnection, HTTPException from httplib import HTTPSConnection, HTTPException
from urllib import urlencode from urllib import urlencode
from ssl import SSLError from ssl import SSLError
@ -77,7 +78,7 @@ class PushalotNotifier:
"/api/sendmessage", "/api/sendmessage",
headers={'Content-type': "application/x-www-form-urlencoded"}, headers={'Content-type': "application/x-www-form-urlencoded"},
body=urlencode(data)) body=urlencode(data))
except (SSLError, HTTPException): except (SSLError, HTTPException, socket.error):
logger.log(u"Pushalot notification failed.", logger.ERROR) logger.log(u"Pushalot notification failed.", logger.ERROR)
return False return False
response = http_handler.getresponse() response = http_handler.getresponse()

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>. # along with SickRage. If not, see <http://www.gnu.org/licenses/>.
import socket
import base64 import base64
from httplib import HTTPSConnection, HTTPException from httplib import HTTPSConnection, HTTPException
import json import json
@ -86,7 +86,7 @@ class PushbulletNotifier:
try: try:
logger.log(u"Testing Pushbullet authentication and retrieving the device list.", logger.DEBUG) logger.log(u"Testing Pushbullet authentication and retrieving the device list.", logger.DEBUG)
http_handler.request(method, uri, None, headers={'Authorization': 'Basic %s:' % authString}) http_handler.request(method, uri, None, headers={'Authorization': 'Basic %s:' % authString})
except (SSLError, HTTPException): except (SSLError, HTTPException, socket.error):
logger.log(u"Pushbullet notification failed.", logger.ERROR) logger.log(u"Pushbullet notification failed.", logger.ERROR)
return False return False
else: else:
@ -101,7 +101,7 @@ class PushbulletNotifier:
http_handler.request(method, uri, body=data, http_handler.request(method, uri, body=data,
headers={'Content-Type': 'application/json', 'Authorization': 'Basic %s' % authString}) headers={'Content-Type': 'application/json', 'Authorization': 'Basic %s' % authString})
pass pass
except (SSLError, HTTPException): except (SSLError, HTTPException, socket.error):
return False return False
response = http_handler.getresponse() response = http_handler.getresponse()