upgrade requests to latest master
This commit is contained in:
parent
4b67dd332e
commit
8e5511c7ff
2 changed files with 16 additions and 2 deletions
|
@ -688,6 +688,8 @@ class Response(object):
|
||||||
"""Iterates over the response data, one line at a time. When
|
"""Iterates over the response data, one line at a time. When
|
||||||
stream=True is set on the request, this avoids reading the
|
stream=True is set on the request, this avoids reading the
|
||||||
content at once into memory for large responses.
|
content at once into memory for large responses.
|
||||||
|
|
||||||
|
.. note:: This method is not reentrant safe.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pending = None
|
pending = None
|
||||||
|
|
|
@ -27,9 +27,13 @@ import sys
|
||||||
|
|
||||||
class VendorAlias(object):
|
class VendorAlias(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, package_names):
|
||||||
|
self._package_names = package_names
|
||||||
self._vendor_name = __name__
|
self._vendor_name = __name__
|
||||||
self._vendor_pkg = self._vendor_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):
|
def find_module(self, fullname, path=None):
|
||||||
if fullname.startswith(self._vendor_pkg):
|
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
|
# Check to see if we already have this item in sys.modules, if we do
|
||||||
# then simply return that.
|
# then simply return that.
|
||||||
if name in sys.modules:
|
if name in sys.modules:
|
||||||
|
@ -92,4 +104,4 @@ class VendorAlias(object):
|
||||||
return module
|
return module
|
||||||
|
|
||||||
|
|
||||||
sys.meta_path.append(VendorAlias())
|
sys.meta_path.append(VendorAlias(["urllib3", "chardet"]))
|
||||||
|
|
Loading…
Reference in a new issue