Browse Source

Merge branch 'feature/UpdateRequests' into develop

tags/release_0.25.1
JackDandy 5 years ago
parent
commit
42c714fd67
  1. 4
      CHANGES.md
  2. 20
      lib/requests/__init__.py
  3. 4
      lib/requests/__version__.py
  4. 9
      lib/requests/exceptions.py
  5. 16
      lib/requests/models.py
  6. 10
      lib/requests/sessions.py
  7. 2
      lib/requests/utils.py

4
CHANGES.md

@ -30,7 +30,7 @@
* Update MsgPack 0.6.1 (05ff11d) to 1.0.0 (fa7d744)
* Update profilehooks module 1.11.0 (e17f378) to 1.11.2 (d72cc2b)
* Update PySocks 1.7.0 (91dcdf0) to 1.7.1 (c2fa43c)
* Update Requests library 2.22.0 (3d968ff) to 2.23.0 (b7c6aba)
* Update Requests library 2.22.0 (3d968ff) to 2.24.0 (1b41763)
* Update Six compatibility library 1.13.0 (ec58185) to 1.15.0 (c0be881)
* Update soupsieve_py3 2.0.0.dev (69194a2) to 2.0.0.final (e66c311)
* Update soupsieve_py2 1.9.5 (6a38398) to 1.9.6 final (f9c96ec)
@ -63,6 +63,8 @@
* Update Certifi 2019.06.16 (84dc766) to 2019.11.28 (21abb9b)
* Update dateutil 2.8.1 (fc9b162) to 2.8.1 (110a09b)
* Update Requests library 2.22.0 (3d968ff) to 2.22.0 (d2f65af)
* Update Requests library 2.22.0 (d2f65af) to 2.23.0 (b7c6aba)
* Update Requests library 2.23.0 (b7c6aba) to 2.24.0 (1b41763)
* Update Six compatibility library 1.13.0 (ec58185) to 1.14.0 (3a3db75)
* Update soupsieve_py3 2.0.0.dev (69194a2) to 2.0.0.final (8832584)
* Update soupsieve_py2 1.9.5 (6a38398) to 1.9.5 final (e00a882)

20
lib/requests/__init__.py

@ -90,14 +90,22 @@ except (AssertionError, ValueError):
"version!".format(urllib3.__version__, chardet.__version__),
RequestsDependencyWarning)
# Attempt to enable urllib3's SNI support, if possible
# Attempt to enable urllib3's fallback for SNI support
# if the standard library doesn't support SNI or the
# 'ssl' library isn't available.
try:
from urllib3.contrib import pyopenssl
pyopenssl.inject_into_urllib3()
try:
import ssl
except ImportError:
ssl = None
if not getattr(ssl, "HAS_SNI", False):
from urllib3.contrib import pyopenssl
pyopenssl.inject_into_urllib3()
# Check cryptography version
from cryptography import __version__ as cryptography_version
_check_cryptography(cryptography_version)
# Check cryptography version
from cryptography import __version__ as cryptography_version
_check_cryptography(cryptography_version)
except ImportError:
pass

4
lib/requests/__version__.py

@ -5,8 +5,8 @@
__title__ = 'requests'
__description__ = 'Python HTTP for Humans.'
__url__ = 'https://requests.readthedocs.io'
__version__ = '2.23.0'
__build__ = 0x022300
__version__ = '2.24.0'
__build__ = 0x022400
__author__ = 'Kenneth Reitz'
__author_email__ = 'me@kennethreitz.org'
__license__ = 'Apache 2.0'

9
lib/requests/exceptions.py

@ -94,11 +94,11 @@ class ChunkedEncodingError(RequestException):
class ContentDecodingError(RequestException, BaseHTTPError):
"""Failed to decode response content"""
"""Failed to decode response content."""
class StreamConsumedError(RequestException, TypeError):
"""The content for this response was already consumed"""
"""The content for this response was already consumed."""
class RetryError(RequestException):
@ -106,21 +106,18 @@ class RetryError(RequestException):
class UnrewindableBodyError(RequestException):
"""Requests encountered an error when trying to rewind a body"""
"""Requests encountered an error when trying to rewind a body."""
# Warnings
class RequestsWarning(Warning):
"""Base warning for Requests."""
pass
class FileModeWarning(RequestsWarning, DeprecationWarning):
"""A file was opened in text mode, but Requests determined its binary length."""
pass
class RequestsDependencyWarning(RequestsWarning):
"""An imported dependency doesn't match the expected version range."""
pass

16
lib/requests/models.py

@ -273,7 +273,9 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
"""The fully mutable :class:`PreparedRequest <PreparedRequest>` object,
containing the exact bytes that will be sent to the server.
Generated from either a :class:`Request <Request>` object or manually.
Instances are generated from a :class:`Request <Request>` object, and
should not be instantiated manually; doing so may produce undesirable
effects.
Usage::
@ -473,12 +475,12 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
not isinstance(data, (basestring, list, tuple, Mapping))
])
try:
length = super_len(data)
except (TypeError, AttributeError, UnsupportedOperation):
length = None
if is_stream:
try:
length = super_len(data)
except (TypeError, AttributeError, UnsupportedOperation):
length = None
body = data
if getattr(body, 'tell', None) is not None:
@ -916,7 +918,7 @@ class Response(object):
return l
def raise_for_status(self):
"""Raises stored :class:`HTTPError`, if one occurred."""
"""Raises :class:`HTTPError`, if one occurred."""
http_error_msg = ''
if isinstance(self.reason, bytes):

10
lib/requests/sessions.py

@ -658,11 +658,13 @@ class Session(SessionRedirectMixin):
extract_cookies_to_jar(self.cookies, request, r.raw)
# Redirect resolving generator.
gen = self.resolve_redirects(r, request, **kwargs)
# Resolve redirects if allowed.
history = [resp for resp in gen] if allow_redirects else []
if allow_redirects:
# Redirect resolving generator.
gen = self.resolve_redirects(r, request, **kwargs)
history = [resp for resp in gen]
else:
history = []
# Shuffle things around if there's history.
if history:

2
lib/requests/utils.py

@ -212,7 +212,7 @@ def get_netrc_auth(url, raise_errors=False):
if raise_errors:
raise
# AppEngine hackiness.
# App Engine hackiness.
except (ImportError, AttributeError):
pass

Loading…
Cancel
Save