summaryrefslogtreecommitdiff
path: root/pip/_vendor/requests/packages
diff options
context:
space:
mode:
authorCory Benfield <lukasaoz@gmail.com>2015-03-15 12:08:47 +0000
committerCory Benfield <lukasaoz@gmail.com>2015-03-15 12:08:47 +0000
commit91183b5cf80c81e8d963c57e365650772af4ce03 (patch)
treeb9a310092858db92039d053675e4f44fa159c086 /pip/_vendor/requests/packages
parent5a32a4d34a937e90d076793f125a73253320da3e (diff)
downloadpip-91183b5cf80c81e8d963c57e365650772af4ce03.tar.gz
Upgrade requests to 2.6.0.
Also brings urllib3 to 43b5b2b452e4344374de7d08ececcca495079b8d
Diffstat (limited to 'pip/_vendor/requests/packages')
-rw-r--r--pip/_vendor/requests/packages/__init__.py16
-rw-r--r--pip/_vendor/requests/packages/urllib3/__init__.py2
-rw-r--r--pip/_vendor/requests/packages/urllib3/_collections.py27
-rw-r--r--pip/_vendor/requests/packages/urllib3/exceptions.py5
-rw-r--r--pip/_vendor/requests/packages/urllib3/util/ssl_.py11
5 files changed, 44 insertions, 17 deletions
diff --git a/pip/_vendor/requests/packages/__init__.py b/pip/_vendor/requests/packages/__init__.py
index ec6a9e064..4dcf870f3 100644
--- a/pip/_vendor/requests/packages/__init__.py
+++ b/pip/_vendor/requests/packages/__init__.py
@@ -27,9 +27,13 @@ import sys
class VendorAlias(object):
- def __init__(self):
+ def __init__(self, package_names):
+ self._package_names = package_names
self._vendor_name = __name__
self._vendor_pkg = self._vendor_name + "."
+ self._vendor_pkgs = [
+ self._vendor_pkg + name for name in self._package_names
+ ]
def find_module(self, fullname, path=None):
if fullname.startswith(self._vendor_pkg):
@@ -44,6 +48,14 @@ class VendorAlias(object):
)
)
+ if not (name == self._vendor_name or
+ any(name.startswith(pkg) for pkg in self._vendor_pkgs)):
+ raise ImportError(
+ "Cannot import %s, must be one of %s." % (
+ name, self._vendor_pkgs
+ )
+ )
+
# Check to see if we already have this item in sys.modules, if we do
# then simply return that.
if name in sys.modules:
@@ -92,4 +104,4 @@ class VendorAlias(object):
return module
-sys.meta_path.append(VendorAlias())
+sys.meta_path.append(VendorAlias(["urllib3", "chardet"]))
diff --git a/pip/_vendor/requests/packages/urllib3/__init__.py b/pip/_vendor/requests/packages/urllib3/__init__.py
index d7592ae79..0660b9c83 100644
--- a/pip/_vendor/requests/packages/urllib3/__init__.py
+++ b/pip/_vendor/requests/packages/urllib3/__init__.py
@@ -4,7 +4,7 @@ urllib3 - Thread-safe connection pooling and re-using.
__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
__license__ = 'MIT'
-__version__ = 'dev'
+__version__ = '1.10.2'
from .connectionpool import (
diff --git a/pip/_vendor/requests/packages/urllib3/_collections.py b/pip/_vendor/requests/packages/urllib3/_collections.py
index 06412ddf3..cc424de0f 100644
--- a/pip/_vendor/requests/packages/urllib3/_collections.py
+++ b/pip/_vendor/requests/packages/urllib3/_collections.py
@@ -20,8 +20,6 @@ from .packages.six import iterkeys, itervalues, PY3
__all__ = ['RecentlyUsedContainer', 'HTTPHeaderDict']
-MULTIPLE_HEADERS_ALLOWED = frozenset(['cookie', 'set-cookie', 'set-cookie2'])
-
_Null = object()
@@ -143,7 +141,10 @@ class HTTPHeaderDict(dict):
def __init__(self, headers=None, **kwargs):
dict.__init__(self)
if headers is not None:
- self.extend(headers)
+ if isinstance(headers, HTTPHeaderDict):
+ self._copy_from(headers)
+ else:
+ self.extend(headers)
if kwargs:
self.extend(kwargs)
@@ -223,11 +224,8 @@ class HTTPHeaderDict(dict):
vals.append(val)
else:
# vals should be a tuple then, i.e. only one item so far
- if key_lower in MULTIPLE_HEADERS_ALLOWED:
- # Need to convert the tuple to list for further extension
- _dict_setitem(self, key_lower, [vals[0], vals[1], val])
- else:
- _dict_setitem(self, key_lower, new_vals)
+ # Need to convert the tuple to list for further extension
+ _dict_setitem(self, key_lower, [vals[0], vals[1], val])
def extend(*args, **kwargs):
"""Generic import function for any type of header-like object.
@@ -276,14 +274,17 @@ class HTTPHeaderDict(dict):
def __repr__(self):
return "%s(%s)" % (type(self).__name__, dict(self.itermerged()))
- def copy(self):
- clone = type(self)()
- for key in self:
- val = _dict_getitem(self, key)
+ def _copy_from(self, other):
+ for key in other:
+ val = _dict_getitem(other, key)
if isinstance(val, list):
# Don't need to convert tuples
val = list(val)
- _dict_setitem(clone, key, val)
+ _dict_setitem(self, key, val)
+
+ def copy(self):
+ clone = type(self)()
+ clone._copy_from(self)
return clone
def iteritems(self):
diff --git a/pip/_vendor/requests/packages/urllib3/exceptions.py b/pip/_vendor/requests/packages/urllib3/exceptions.py
index 0c6fd3c51..5d5230112 100644
--- a/pip/_vendor/requests/packages/urllib3/exceptions.py
+++ b/pip/_vendor/requests/packages/urllib3/exceptions.py
@@ -157,3 +157,8 @@ class InsecureRequestWarning(SecurityWarning):
class SystemTimeWarning(SecurityWarning):
"Warned when system time is suspected to be wrong"
pass
+
+
+class InsecurePlatformWarning(SecurityWarning):
+ "Warned when certain SSL configuration is not available on a platform."
+ pass
diff --git a/pip/_vendor/requests/packages/urllib3/util/ssl_.py b/pip/_vendor/requests/packages/urllib3/util/ssl_.py
index ee1d32235..e7e7dfae1 100644
--- a/pip/_vendor/requests/packages/urllib3/util/ssl_.py
+++ b/pip/_vendor/requests/packages/urllib3/util/ssl_.py
@@ -1,7 +1,7 @@
from binascii import hexlify, unhexlify
from hashlib import md5, sha1, sha256
-from ..exceptions import SSLError
+from ..exceptions import SSLError, InsecurePlatformWarning
SSLContext = None
@@ -10,6 +10,7 @@ create_default_context = None
import errno
import ssl
+import warnings
try: # Test for SSL features
from ssl import wrap_socket, CERT_NONE, PROTOCOL_SSLv23
@@ -69,6 +70,14 @@ except ImportError:
self.ciphers = cipher_suite
def wrap_socket(self, socket, server_hostname=None):
+ warnings.warn(
+ 'A true SSLContext object is not available. This prevents '
+ 'urllib3 from configuring SSL appropriately and may cause '
+ 'certain SSL connections to fail. For more information, see '
+ 'https://urllib3.readthedocs.org/en/latest/security.html'
+ '#insecureplatformwarning.',
+ InsecurePlatformWarning
+ )
kwargs = {
'keyfile': self.keyfile,
'certfile': self.certfile,