From a803e845a5676c6a09087584051bccb412cf08dc Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Thu, 28 Dec 2017 18:32:12 +0100 Subject: [PATCH] More robust urllib3 import --- httpie/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/httpie/client.py b/httpie/client.py index 1ffc6fbd..0c66db41 100644 --- a/httpie/client.py +++ b/httpie/client.py @@ -3,7 +3,6 @@ import sys import requests from requests.adapters import HTTPAdapter -from requests.packages import urllib3 from httpie import sessions from httpie import __version__ @@ -14,8 +13,10 @@ from httpie.utils import repr_dict_nice try: # https://urllib3.readthedocs.io/en/latest/security.html + # noinspection PyPackageRequirements + import urllib3 urllib3.disable_warnings() -except AttributeError: +except (ImportError, AttributeError): # 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 # cases, we don't need to call the method.