utils.request: clean imports using feature.moves

This commit is contained in:
Noam Meltzer 2016-04-27 23:55:00 +03:00
parent e160355190
commit 0ca3ef7a38

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python
# pylint: disable=no-name-in-module,unused-import
# #
# A library that provides a Python interface to the Telegram Bot API # A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016 # Copyright (C) 2015-2016
@ -25,22 +24,9 @@ import json
import socket import socket
from ssl import SSLError from ssl import SSLError
try: from future.moves.http.client import HTTPException
# python2 from future.moves.urllib.error import HTTPError, URLError
from httplib import HTTPException from future.moves.urllib.request import urlopen, urlretrieve, Request
except ImportError:
# python3
from http.client import HTTPException
try:
# python3
from urllib.request import urlopen, urlretrieve, Request
from urllib.error import HTTPError, URLError
except ImportError:
# python2
from urllib import urlretrieve
from urllib2 import urlopen, Request, URLError
from urllib2 import HTTPError
from telegram import (InputFile, TelegramError) from telegram import (InputFile, TelegramError)
from telegram.error import Unauthorized, NetworkError, TimedOut from telegram.error import Unauthorized, NetworkError, TimedOut