|
|
070c3b |
From 5d23c608e72025f72e1f3223cb6c7e3979e93c7f Mon Sep 17 00:00:00 2001
|
|
|
070c3b |
From: Ralph Bean <rbean@redhat.com>
|
|
|
070c3b |
Date: Thu, 28 Feb 2013 10:57:20 -0500
|
|
|
070c3b |
Subject: [PATCH] system-urllib3
|
|
|
070c3b |
|
|
|
070c3b |
---
|
|
|
070c3b |
requests/adapters.py | 12 ++++++------
|
|
|
070c3b |
requests/compat.py | 6 +++++-
|
|
|
070c3b |
requests/models.py | 4 ++--
|
|
|
070c3b |
3 files changed, 13 insertions(+), 9 deletions(-)
|
|
|
070c3b |
|
|
|
070c3b |
diff --git a/requests/adapters.py b/requests/adapters.py
|
|
|
070c3b |
index 5f9d9c7..1f61bd6 100644
|
|
|
070c3b |
--- a/requests/adapters.py
|
|
|
070c3b |
+++ b/requests/adapters.py
|
|
|
070c3b |
@@ -11,17 +11,17 @@ and maintain connections.
|
|
|
070c3b |
import socket
|
|
|
070c3b |
|
|
|
070c3b |
from .models import Response
|
|
|
070c3b |
-from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
|
|
|
070c3b |
-from .packages.urllib3.response import HTTPResponse
|
|
|
070c3b |
+from urllib3.poolmanager import PoolManager, proxy_from_url
|
|
|
070c3b |
+from urllib3.response import HTTPResponse
|
|
|
070c3b |
from .hooks import dispatch_hook
|
|
|
070c3b |
from .compat import urlparse, basestring, urldefrag
|
|
|
070c3b |
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
|
|
|
070c3b |
prepend_scheme_if_needed)
|
|
|
070c3b |
from .structures import CaseInsensitiveDict
|
|
|
070c3b |
-from .packages.urllib3.exceptions import MaxRetryError
|
|
|
070c3b |
-from .packages.urllib3.exceptions import TimeoutError
|
|
|
070c3b |
-from .packages.urllib3.exceptions import SSLError as _SSLError
|
|
|
070c3b |
-from .packages.urllib3.exceptions import HTTPError as _HTTPError
|
|
|
070c3b |
+from urllib3.exceptions import MaxRetryError
|
|
|
070c3b |
+from urllib3.exceptions import TimeoutError
|
|
|
070c3b |
+from urllib3.exceptions import SSLError as _SSLError
|
|
|
070c3b |
+from urllib3.exceptions import HTTPError as _HTTPError
|
|
|
070c3b |
from .cookies import extract_cookies_to_jar
|
|
|
070c3b |
from .exceptions import ConnectionError, Timeout, SSLError
|
|
|
070c3b |
|
|
|
070c3b |
diff --git a/requests/compat.py b/requests/compat.py
|
|
|
070c3b |
index 39421ed..d9ab218 100644
|
|
|
070c3b |
--- a/requests/compat.py
|
|
|
070c3b |
+++ b/requests/compat.py
|
|
|
070c3b |
@@ -89,7 +89,11 @@ if is_py2:
|
|
|
070c3b |
import cookielib
|
|
|
070c3b |
from Cookie import Morsel
|
|
|
070c3b |
from StringIO import StringIO
|
|
|
070c3b |
- from .packages.urllib3.packages.ordered_dict import OrderedDict
|
|
|
070c3b |
+
|
|
|
070c3b |
+ try:
|
|
|
070c3b |
+ from collections import OrderedDict
|
|
|
070c3b |
+ except ImportError:
|
|
|
070c3b |
+ from ordereddict import OrderedDict
|
|
|
070c3b |
|
|
|
070c3b |
builtin_str = str
|
|
|
070c3b |
bytes = str
|
|
|
070c3b |
diff --git a/requests/models.py b/requests/models.py
|
|
|
070c3b |
index 5202e6f..218b4f2 100644
|
|
|
070c3b |
--- a/requests/models.py
|
|
|
070c3b |
+++ b/requests/models.py
|
|
|
070c3b |
@@ -17,7 +17,7 @@ from .status_codes import codes
|
|
|
070c3b |
|
|
|
070c3b |
from .auth import HTTPBasicAuth
|
|
|
070c3b |
from .cookies import cookiejar_from_dict, get_cookie_header
|
|
|
070c3b |
-from .packages.urllib3.filepost import encode_multipart_formdata
|
|
|
070c3b |
+from urllib3.filepost import encode_multipart_formdata
|
|
|
070c3b |
from .exceptions import HTTPError, RequestException, MissingSchema, InvalidURL
|
|
|
070c3b |
from .utils import (
|
|
|
070c3b |
stream_untransfer, guess_filename, requote_uri,
|
|
|
070c3b |
@@ -121,7 +121,7 @@ class RequestEncodingMixin(object):
|
|
|
070c3b |
fp = StringIO(fp)
|
|
|
070c3b |
if isinstance(fp, bytes):
|
|
|
070c3b |
fp = BytesIO(fp)
|
|
|
070c3b |
-
|
|
|
070c3b |
+
|
|
|
070c3b |
if ft:
|
|
|
070c3b |
new_v = (fn, fp.read(), ft)
|
|
|
070c3b |
else:
|
|
|
070c3b |
--
|
|
|
070c3b |
1.8.1.2
|
|
|
070c3b |
|