mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-29 03:32:49 +01:00
parent
6166e7f07a
commit
dc032b349c
1 changed files with 9 additions and 0 deletions
|
@ -25,6 +25,13 @@ import json
|
||||||
import socket
|
import socket
|
||||||
from ssl import SSLError
|
from ssl import SSLError
|
||||||
|
|
||||||
|
try:
|
||||||
|
# python2
|
||||||
|
from httplib import HTTPException
|
||||||
|
except ImportError:
|
||||||
|
# python3
|
||||||
|
from http.client import HTTPException
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from urllib.request import urlopen, urlretrieve, Request
|
from urllib.request import urlopen, urlretrieve, Request
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
|
@ -82,6 +89,8 @@ def _try_except_req(func):
|
||||||
raise TelegramError("Timed out")
|
raise TelegramError("Timed out")
|
||||||
|
|
||||||
raise TelegramError(str(error))
|
raise TelegramError(str(error))
|
||||||
|
except HTTPException as error:
|
||||||
|
raise TelegramError('HTTPException: {0!r}'.format(error))
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue