mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-26 09:07:43 +01:00
utils.request: clean imports using feature.moves
This commit is contained in:
parent
e160355190
commit
0ca3ef7a38
1 changed files with 3 additions and 17 deletions
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=no-name-in-module,unused-import
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2016
|
||||
|
@ -25,22 +24,9 @@ import json
|
|||
import socket
|
||||
from ssl import SSLError
|
||||
|
||||
try:
|
||||
# python2
|
||||
from httplib import HTTPException
|
||||
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 future.moves.http.client import HTTPException
|
||||
from future.moves.urllib.error import HTTPError, URLError
|
||||
from future.moves.urllib.request import urlopen, urlretrieve, Request
|
||||
|
||||
from telegram import (InputFile, TelegramError)
|
||||
from telegram.error import Unauthorized, NetworkError, TimedOut
|
||||
|
|
Loading…
Reference in a new issue