X Tutup
Skip to content

Commit 0ca3ef7

Browse files
committed
utils.request: clean imports using feature.moves
1 parent e160355 commit 0ca3ef7

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

telegram/utils/request.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# pylint: disable=no-name-in-module,unused-import
32
#
43
# A library that provides a Python interface to the Telegram Bot API
54
# Copyright (C) 2015-2016
@@ -25,22 +24,9 @@
2524
import socket
2625
from ssl import SSLError
2726

28-
try:
29-
# python2
30-
from httplib import HTTPException
31-
except ImportError:
32-
# python3
33-
from http.client import HTTPException
34-
35-
try:
36-
# python3
37-
from urllib.request import urlopen, urlretrieve, Request
38-
from urllib.error import HTTPError, URLError
39-
except ImportError:
40-
# python2
41-
from urllib import urlretrieve
42-
from urllib2 import urlopen, Request, URLError
43-
from urllib2 import HTTPError
27+
from future.moves.http.client import HTTPException
28+
from future.moves.urllib.error import HTTPError, URLError
29+
from future.moves.urllib.request import urlopen, urlretrieve, Request
4430

4531
from telegram import (InputFile, TelegramError)
4632
from telegram.error import Unauthorized, NetworkError, TimedOut

0 commit comments

Comments
 (0)
X Tutup