summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pip/_vendor/requests/__init__.py2
-rw-r--r--pip/_vendor/requests/adapters.py2
-rw-r--r--pip/_vendor/requests/api.py31
-rw-r--r--pip/_vendor/requests/models.py13
-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
-rw-r--r--pip/_vendor/requests/sessions.py5
-rw-r--r--pip/_vendor/vendor.txt2
11 files changed, 82 insertions, 34 deletions
diff --git a/pip/_vendor/requests/__init__.py b/pip/_vendor/requests/__init__.py
index b90d792ed..446500bfd 100644
--- a/pip/_vendor/requests/__init__.py
+++ b/pip/_vendor/requests/__init__.py
@@ -42,7 +42,7 @@ is at <http://python-requests.org>.
"""
__title__ = 'requests'
-__version__ = '2.5.3'
+__version__ = '2.6.0'
__build__ = 0x020503
__author__ = 'Kenneth Reitz'
__license__ = 'Apache 2.0'
diff --git a/pip/_vendor/requests/adapters.py b/pip/_vendor/requests/adapters.py
index c892853b2..02e0dd1f1 100644
--- a/pip/_vendor/requests/adapters.py
+++ b/pip/_vendor/requests/adapters.py
@@ -11,10 +11,10 @@ and maintain connections.
import socket
from .models import Response
-from .packages.urllib3 import Retry
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 .compat import urlparse, basestring
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
prepend_scheme_if_needed, get_auth_from_url, urldefragauth)
diff --git a/pip/_vendor/requests/api.py b/pip/_vendor/requests/api.py
index 1469b05c4..98c92298e 100644
--- a/pip/_vendor/requests/api.py
+++ b/pip/_vendor/requests/api.py
@@ -16,7 +16,6 @@ from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
- Returns :class:`Response <Response>` object.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
@@ -37,6 +36,8 @@ def request(method, url, **kwargs):
:param verify: (optional) if ``True``, the SSL cert will be verified. A CA_BUNDLE path can also be provided.
:param stream: (optional) if ``False``, the response content will be immediately downloaded.
:param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
+ :return: :class:`Response <Response>` object
+ :rtype: requests.Response
Usage::
@@ -55,10 +56,12 @@ def request(method, url, **kwargs):
def get(url, **kwargs):
- """Sends a GET request. Returns :class:`Response` object.
+ """Sends a GET request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
+ :return: :class:`Response <Response>` object
+ :rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', True)
@@ -66,10 +69,12 @@ def get(url, **kwargs):
def options(url, **kwargs):
- """Sends a OPTIONS request. Returns :class:`Response` object.
+ """Sends a OPTIONS request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
+ :return: :class:`Response <Response>` object
+ :rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', True)
@@ -77,10 +82,12 @@ def options(url, **kwargs):
def head(url, **kwargs):
- """Sends a HEAD request. Returns :class:`Response` object.
+ """Sends a HEAD request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
+ :return: :class:`Response <Response>` object
+ :rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', False)
@@ -88,44 +95,52 @@ def head(url, **kwargs):
def post(url, data=None, json=None, **kwargs):
- """Sends a POST request. Returns :class:`Response` object.
+ """Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
+ :return: :class:`Response <Response>` object
+ :rtype: requests.Response
"""
return request('post', url, data=data, json=json, **kwargs)
def put(url, data=None, **kwargs):
- """Sends a PUT request. Returns :class:`Response` object.
+ """Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
+ :return: :class:`Response <Response>` object
+ :rtype: requests.Response
"""
return request('put', url, data=data, **kwargs)
def patch(url, data=None, **kwargs):
- """Sends a PATCH request. Returns :class:`Response` object.
+ """Sends a PATCH request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
+ :return: :class:`Response <Response>` object
+ :rtype: requests.Response
"""
return request('patch', url, data=data, **kwargs)
def delete(url, **kwargs):
- """Sends a DELETE request. Returns :class:`Response` object.
+ """Sends a DELETE request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
+ :return: :class:`Response <Response>` object
+ :rtype: requests.Response
"""
return request('delete', url, **kwargs)
diff --git a/pip/_vendor/requests/models.py b/pip/_vendor/requests/models.py
index b728c84e4..419cf0a8b 100644
--- a/pip/_vendor/requests/models.py
+++ b/pip/_vendor/requests/models.py
@@ -143,12 +143,13 @@ class RequestEncodingMixin(object):
else:
fn = guess_filename(v) or k
fp = v
- if isinstance(fp, str):
- fp = StringIO(fp)
- if isinstance(fp, bytes):
- fp = BytesIO(fp)
- rf = RequestField(name=k, data=fp.read(),
+ if isinstance(fp, (str, bytes, bytearray)):
+ fdata = fp
+ else:
+ fdata = fp.read()
+
+ rf = RequestField(name=k, data=fdata,
filename=fn, headers=fh)
rf.make_multipart(content_type=ft)
new_fields.append(rf)
@@ -688,6 +689,8 @@ class Response(object):
"""Iterates over the response data, one line at a time. When
stream=True is set on the request, this avoids reading the
content at once into memory for large responses.
+
+ .. note:: This method is not reentrant safe.
"""
pending = None
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,
diff --git a/pip/_vendor/requests/sessions.py b/pip/_vendor/requests/sessions.py
index 4f3069635..ef3f22bc5 100644
--- a/pip/_vendor/requests/sessions.py
+++ b/pip/_vendor/requests/sessions.py
@@ -171,7 +171,10 @@ class SessionRedirectMixin(object):
except KeyError:
pass
- extract_cookies_to_jar(prepared_request._cookies, prepared_request, resp.raw)
+ # Extract any cookies sent on the response to the cookiejar
+ # in the new request. Because we've mutated our copied prepared
+ # request, use the old one that we haven't yet touched.
+ extract_cookies_to_jar(prepared_request._cookies, req, resp.raw)
prepared_request._cookies.update(self.cookies)
prepared_request.prepare_cookies(prepared_request._cookies)
diff --git a/pip/_vendor/vendor.txt b/pip/_vendor/vendor.txt
index a6cc87287..ab6f7528a 100644
--- a/pip/_vendor/vendor.txt
+++ b/pip/_vendor/vendor.txt
@@ -2,7 +2,7 @@ distlib==0.2.0
html5lib==0.999 # See: https://github.com/html5lib/html5lib-python/issues/161
six==1.9.0
colorama==0.3.3
-requests==2.5.3
+requests==2.6.0
CacheControl==0.11.1
lockfile==0.10.2
progress==1.2