Merge pull request #155 from tsnoam/master

_try_except_req(): catch httplib.HTTPException
This commit is contained in:
Jannes Höke 2016-01-22 02:48:11 +01:00
commit fe26c94440

View file

@ -25,6 +25,13 @@ import json
import socket
from ssl import SSLError
try:
# python2
from httplib import HTTPException
except ImportError:
# python3
from http.client import HTTPException
try:
from urllib.request import urlopen, urlretrieve, Request
from urllib.error import HTTPError
@ -82,6 +89,8 @@ def _try_except_req(func):
raise TelegramError("Timed out")
raise TelegramError(str(error))
except HTTPException as error:
raise TelegramError('HTTPException: {0!r}'.format(error))
return decorator