diff --git a/requests/__init__.py b/requests/__init__.py index 446500b..8257b61 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -50,7 +50,7 @@ __copyright__ = 'Copyright 2015 Kenneth Reitz' # Attempt to enable urllib3's SNI support, if possible try: - from .packages.urllib3.contrib import pyopenssl + from urllib3.contrib import pyopenssl pyopenssl.inject_into_urllib3() except ImportError: pass diff --git a/requests/adapters.py b/requests/adapters.py index 02e0dd1..daae42e 100644 --- a/requests/adapters.py +++ b/requests/adapters.py @@ -11,22 +11,22 @@ and maintain connections. import socket from .models import Response -from .packages.urllib3.poolmanager import PoolManager, proxy_from_url -from .packages.urllib3.response import HTTPResponse -from .packages.urllib3.util import Timeout as TimeoutSauce -from .packages.urllib3.util.retry import Retry +from urllib3.poolmanager import PoolManager, proxy_from_url +from urllib3.response import HTTPResponse +from urllib3.util import Timeout as TimeoutSauce +from urllib3.util.retry import Retry from .compat import urlparse, basestring from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers, prepend_scheme_if_needed, get_auth_from_url, urldefragauth) from .structures import CaseInsensitiveDict -from .packages.urllib3.exceptions import ConnectTimeoutError -from .packages.urllib3.exceptions import HTTPError as _HTTPError -from .packages.urllib3.exceptions import MaxRetryError -from .packages.urllib3.exceptions import ProxyError as _ProxyError -from .packages.urllib3.exceptions import ProtocolError -from .packages.urllib3.exceptions import ReadTimeoutError -from .packages.urllib3.exceptions import SSLError as _SSLError -from .packages.urllib3.exceptions import ResponseError +from urllib3.exceptions import ConnectTimeoutError +from urllib3.exceptions import HTTPError as _HTTPError +from urllib3.exceptions import MaxRetryError +from urllib3.exceptions import ProxyError as _ProxyError +from urllib3.exceptions import ProtocolError +from urllib3.exceptions import ReadTimeoutError +from urllib3.exceptions import SSLError as _SSLError +from urllib3.exceptions import ResponseError from .cookies import extract_cookies_to_jar from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError, ProxyError, RetryError) diff --git a/requests/compat.py b/requests/compat.py index 40bb6c5..4232288 100644 --- a/requests/compat.py +++ b/requests/compat.py @@ -4,7 +4,7 @@ pythoncompat """ -from .packages import chardet +import chardet import sys diff --git a/requests/exceptions.py b/requests/exceptions.py index 89135a8..b70c525 100644 --- a/requests/exceptions.py +++ b/requests/exceptions.py @@ -7,7 +7,7 @@ requests.exceptions This module contains the set of Requests' exceptions. """ -from .packages.urllib3.exceptions import HTTPError as BaseHTTPError +from urllib3.exceptions import HTTPError as BaseHTTPError class RequestException(IOError): diff --git a/requests/models.py b/requests/models.py index 419cf0a..131b88d 100644 --- a/requests/models.py +++ b/requests/models.py @@ -16,10 +16,10 @@ from .structures import CaseInsensitiveDict from .auth import HTTPBasicAuth from .cookies import cookiejar_from_dict, get_cookie_header -from .packages.urllib3.fields import RequestField -from .packages.urllib3.filepost import encode_multipart_formdata -from .packages.urllib3.util import parse_url -from .packages.urllib3.exceptions import ( +from urllib3.fields import RequestField +from urllib3.filepost import encode_multipart_formdata +from urllib3.util import parse_url +from urllib3.exceptions import ( DecodeError, ReadTimeoutError, ProtocolError, LocationParseError) from .exceptions import ( HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError, diff --git a/requests/sessions.py b/requests/sessions.py index 9a51f33..22bd226 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -21,7 +21,7 @@ from .hooks import default_hooks, dispatch_hook from .utils import to_key_val_list, default_headers, to_native_string, DEFAULT_PORTS from .exceptions import ( TooManyRedirects, InvalidSchema, ChunkedEncodingError, ContentDecodingError) -from .packages.urllib3._collections import RecentlyUsedContainer +from urllib3._collections import RecentlyUsedContainer from .structures import CaseInsensitiveDict from .adapters import HTTPAdapter diff --git a/test_requests.py b/test_requests.py index cf7c722..690b3ed 100755 --- a/test_requests.py +++ b/test_requests.py @@ -1655,7 +1655,7 @@ def test_prepare_unicode_url(): def test_urllib3_retries(): - from requests.packages.urllib3.util import Retry + from urllib3.util import Retry s = requests.Session() s.mount('http://', HTTPAdapter(max_retries=Retry( total=2, status_forcelist=[500]