Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions telegram/utils/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
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
Expand Down Expand Up @@ -82,6 +89,8 @@ def decorator(*args, **kwargs):
raise TelegramError("Timed out")

raise TelegramError(str(error))
except HTTPException as error:
raise TelegramError('HTTPException: {0!r}'.format(error))

return decorator

Expand Down