mirror of
https://github.com/httpie/cli.git
synced 2025-06-25 12:01:41 +02:00
More robust urllib3 import
This commit is contained in:
parent
11be041e06
commit
a803e845a5
@ -3,7 +3,6 @@ import sys
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
from requests.adapters import HTTPAdapter
|
from requests.adapters import HTTPAdapter
|
||||||
from requests.packages import urllib3
|
|
||||||
|
|
||||||
from httpie import sessions
|
from httpie import sessions
|
||||||
from httpie import __version__
|
from httpie import __version__
|
||||||
@ -14,8 +13,10 @@ from httpie.utils import repr_dict_nice
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# https://urllib3.readthedocs.io/en/latest/security.html
|
# https://urllib3.readthedocs.io/en/latest/security.html
|
||||||
|
# noinspection PyPackageRequirements
|
||||||
|
import urllib3
|
||||||
urllib3.disable_warnings()
|
urllib3.disable_warnings()
|
||||||
except AttributeError:
|
except (ImportError, AttributeError):
|
||||||
# In some rare cases, the user may have an old version of the requests
|
# In some rare cases, the user may have an old version of the requests
|
||||||
# or urllib3, and there is no method called "disable_warnings." In these
|
# or urllib3, and there is no method called "disable_warnings." In these
|
||||||
# cases, we don't need to call the method.
|
# cases, we don't need to call the method.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user