[Python-modules-commits] [requests] 02/10: Import requests_2.18.4.orig.tar.gz
Ondrej Novy
onovy at debian.org
Sat Dec 9 20:49:38 UTC 2017
This is an automated email from the git hooks/post-receive script.
onovy pushed a commit to branch master
in repository requests.
commit 37e04a167a977c6377fa640152b36f05f3a5e1a8
Author: Ondřej Nový <onovy at debian.org>
Date: Sat Dec 9 21:09:03 2017 +0100
Import requests_2.18.4.orig.tar.gz
---
HISTORY.rst | 35 +++++++++++++++++++++++++++++++++++
MANIFEST.in | 2 +-
PKG-INFO | 40 +++++++++++++++++++++++++++++++++++++---
README.rst | 2 +-
requests.egg-info/PKG-INFO | 40 +++++++++++++++++++++++++++++++++++++---
requests.egg-info/SOURCES.txt | 2 ++
requests.egg-info/requires.txt | 8 ++++----
requests/__init__.py | 2 +-
requests/__version__.py | 4 ++--
requests/adapters.py | 5 +++++
requests/compat.py | 4 +---
requests/help.py | 15 ++++++++++++---
requests/models.py | 2 --
requests/sessions.py | 8 +++++++-
requests/utils.py | 4 ++--
requirements.txt | 16 ++++++++++++++++
setup.py | 5 ++---
tests/test_help.py | 40 ++++++++++++++++++++++++++++++++++++++++
tests/test_requests.py | 20 ++++++++++++++++----
19 files changed, 221 insertions(+), 33 deletions(-)
diff --git a/HISTORY.rst b/HISTORY.rst
index a359805..d634e1f 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,41 @@
Release History
---------------
+2.18.4 (2017-08-15)
++++++++++++++++++++
+
+**Improvements**
+
+- Error messages for invalid headers now include the header name for easier debugging
+
+**Dependencies**
+
+- We now support idna v2.6.
+
+2.18.3 (2017-08-02)
++++++++++++++++++++
+
+**Improvements**
+
+- Running ``$ python -m requests.help`` now includes the installed version of idna.
+
+**Bugfixes**
+
+- Fixed issue where Requests would raise ``ConnectionError`` instead of
+ ``SSLError`` when encountering SSL problems when using urllib3 v1.22.
+
+2.18.2 (2017-07-25)
++++++++++++++++++++
+
+**Bugfixes**
+
+- ``requests.help`` no longer fails on Python 2.6 due to the absence of
+ ``ssl.OPENSSL_VERSION_NUMBER``.
+
+**Dependencies**
+
+- We now support urllib3 v1.22.
+
2.18.1 (2017-06-14)
+++++++++++++++++++
diff --git a/MANIFEST.in b/MANIFEST.in
index 650744c..2c0fb95 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,2 @@
-include README.rst LICENSE NOTICE HISTORY.rst pytest.ini
+include README.rst LICENSE NOTICE HISTORY.rst pytest.ini requirements.txt
recursive-include tests *.py
diff --git a/PKG-INFO b/PKG-INFO
index cba1ce8..ee9de6e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: requests
-Version: 2.18.1
+Version: 2.18.4
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
@@ -101,7 +101,7 @@ Description: Requests: HTTP for Humans
$ pip install requests
✨🍰✨
- Satisfaction, guaranteed.
+ Satisfaction guaranteed.
Documentation
-------------
@@ -127,6 +127,41 @@ Description: Requests: HTTP for Humans
Release History
---------------
+ 2.18.4 (2017-08-15)
+ +++++++++++++++++++
+
+ **Improvements**
+
+ - Error messages for invalid headers now include the header name for easier debugging
+
+ **Dependencies**
+
+ - We now support idna v2.6.
+
+ 2.18.3 (2017-08-02)
+ +++++++++++++++++++
+
+ **Improvements**
+
+ - Running ``$ python -m requests.help`` now includes the installed version of idna.
+
+ **Bugfixes**
+
+ - Fixed issue where Requests would raise ``ConnectionError`` instead of
+ ``SSLError`` when encountering SSL problems when using urllib3 v1.22.
+
+ 2.18.2 (2017-07-25)
+ +++++++++++++++++++
+
+ **Bugfixes**
+
+ - ``requests.help`` no longer fails on Python 2.6 due to the absence of
+ ``ssl.OPENSSL_VERSION_NUMBER``.
+
+ **Dependencies**
+
+ - We now support urllib3 v1.22.
+
2.18.1 (2017-06-14)
+++++++++++++++++++
@@ -1624,7 +1659,6 @@ Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
diff --git a/README.rst b/README.rst
index 1dbee79..fe6cf5f 100644
--- a/README.rst
+++ b/README.rst
@@ -93,7 +93,7 @@ To install Requests, simply:
$ pip install requests
✨🍰✨
-Satisfaction, guaranteed.
+Satisfaction guaranteed.
Documentation
-------------
diff --git a/requests.egg-info/PKG-INFO b/requests.egg-info/PKG-INFO
index cba1ce8..ee9de6e 100644
--- a/requests.egg-info/PKG-INFO
+++ b/requests.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: requests
-Version: 2.18.1
+Version: 2.18.4
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
@@ -101,7 +101,7 @@ Description: Requests: HTTP for Humans
$ pip install requests
✨🍰✨
- Satisfaction, guaranteed.
+ Satisfaction guaranteed.
Documentation
-------------
@@ -127,6 +127,41 @@ Description: Requests: HTTP for Humans
Release History
---------------
+ 2.18.4 (2017-08-15)
+ +++++++++++++++++++
+
+ **Improvements**
+
+ - Error messages for invalid headers now include the header name for easier debugging
+
+ **Dependencies**
+
+ - We now support idna v2.6.
+
+ 2.18.3 (2017-08-02)
+ +++++++++++++++++++
+
+ **Improvements**
+
+ - Running ``$ python -m requests.help`` now includes the installed version of idna.
+
+ **Bugfixes**
+
+ - Fixed issue where Requests would raise ``ConnectionError`` instead of
+ ``SSLError`` when encountering SSL problems when using urllib3 v1.22.
+
+ 2.18.2 (2017-07-25)
+ +++++++++++++++++++
+
+ **Bugfixes**
+
+ - ``requests.help`` no longer fails on Python 2.6 due to the absence of
+ ``ssl.OPENSSL_VERSION_NUMBER``.
+
+ **Dependencies**
+
+ - We now support urllib3 v1.22.
+
2.18.1 (2017-06-14)
+++++++++++++++++++
@@ -1624,7 +1659,6 @@ Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
diff --git a/requests.egg-info/SOURCES.txt b/requests.egg-info/SOURCES.txt
index 1de3bcb..ef14632 100644
--- a/requests.egg-info/SOURCES.txt
+++ b/requests.egg-info/SOURCES.txt
@@ -3,6 +3,7 @@ LICENSE
MANIFEST.in
README.rst
pytest.ini
+requirements.txt
setup.cfg
setup.py
requests/__init__.py
@@ -32,6 +33,7 @@ requests.egg-info/top_level.txt
tests/__init__.py
tests/compat.py
tests/conftest.py
+tests/test_help.py
tests/test_hooks.py
tests/test_lowlevel.py
tests/test_packages.py
diff --git a/requests.egg-info/requires.txt b/requests.egg-info/requires.txt
index a410c8b..6dbca83 100644
--- a/requests.egg-info/requires.txt
+++ b/requests.egg-info/requires.txt
@@ -1,6 +1,6 @@
-chardet>=3.0.2,<3.1.0
-idna>=2.5,<2.6
-urllib3>=1.21.1,<1.22
+chardet<3.1.0,>=3.0.2
+idna<2.7,>=2.5
+urllib3<1.23,>=1.21.1
certifi>=2017.4.17
[security]
@@ -9,7 +9,7 @@ cryptography>=1.3.4
idna>=2.0.0
[socks]
-PySocks>=1.5.6, !=1.5.7
+PySocks!=1.5.7,>=1.5.6
[socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")]
win_inet_pton
diff --git a/requests/__init__.py b/requests/__init__.py
index 90a0d11..268e7dc 100644
--- a/requests/__init__.py
+++ b/requests/__init__.py
@@ -57,7 +57,7 @@ def check_compatibility(urllib3_version, chardet_version):
# Check urllib3 for compatibility.
major, minor, patch = urllib3_version # noqa: F811
major, minor, patch = int(major), int(minor), int(patch)
- # urllib3 >= 1.21.1, < 1.22
+ # urllib3 >= 1.21.1, <= 1.22
assert major == 1
assert minor >= 21
assert minor <= 22
diff --git a/requests/__version__.py b/requests/__version__.py
index 8c7ebbb..dc33eef 100644
--- a/requests/__version__.py
+++ b/requests/__version__.py
@@ -5,8 +5,8 @@
__title__ = 'requests'
__description__ = 'Python HTTP for Humans.'
__url__ = 'http://python-requests.org'
-__version__ = '2.18.1'
-__build__ = 0x021801
+__version__ = '2.18.4'
+__build__ = 0x021804
__author__ = 'Kenneth Reitz'
__author_email__ = 'me at kennethreitz.org'
__license__ = 'Apache 2.0'
diff --git a/requests/adapters.py b/requests/adapters.py
index 205da0c..00f8792 100644
--- a/requests/adapters.py
+++ b/requests/adapters.py
@@ -501,6 +501,10 @@ class HTTPAdapter(BaseAdapter):
if isinstance(e.reason, _ProxyError):
raise ProxyError(e, request=request)
+ if isinstance(e.reason, _SSLError):
+ # This branch is for urllib3 v1.22 and later.
+ raise SSLError(e, request=request)
+
raise ConnectionError(e, request=request)
except ClosedPoolError as e:
@@ -511,6 +515,7 @@ class HTTPAdapter(BaseAdapter):
except (_SSLError, _HTTPError) as e:
if isinstance(e, _SSLError):
+ # This branch is for urllib3 versions earlier than v1.22
raise SSLError(e, request=request)
elif isinstance(e, ReadTimeoutError):
raise ReadTimeout(e, request=request)
diff --git a/requests/compat.py b/requests/compat.py
index 5c09ea8..f417cfd 100644
--- a/requests/compat.py
+++ b/requests/compat.py
@@ -27,9 +27,7 @@ is_py3 = (_ver[0] == 3)
try:
import simplejson as json
-except (ImportError, SyntaxError):
- # simplejson does not support Python 3.2, it throws a SyntaxError
- # because of u'...' Unicode literals.
+except ImportError:
import json
# ---------
diff --git a/requests/help.py b/requests/help.py
index 695b5ee..5440ee6 100644
--- a/requests/help.py
+++ b/requests/help.py
@@ -6,6 +6,7 @@ import platform
import sys
import ssl
+import idna
import urllib3
import chardet
@@ -84,18 +85,26 @@ def info():
cryptography_info = {
'version': getattr(cryptography, '__version__', ''),
}
+ idna_info = {
+ 'version': getattr(idna, '__version__', ''),
+ }
+
+ # OPENSSL_VERSION_NUMBER doesn't exist in the Python 2.6 ssl module.
+ system_ssl = getattr(ssl, 'OPENSSL_VERSION_NUMBER', None)
+ system_ssl_info = {
+ 'version': '%x' % system_ssl if system_ssl is not None else ''
+ }
return {
'platform': platform_info,
'implementation': implementation_info,
- 'system_ssl': {
- 'version': '%x' % ssl.OPENSSL_VERSION_NUMBER,
- },
+ 'system_ssl': system_ssl_info,
'using_pyopenssl': pyopenssl is not None,
'pyOpenSSL': pyopenssl_info,
'urllib3': urllib3_info,
'chardet': chardet_info,
'cryptography': cryptography_info,
+ 'idna': idna_info,
'requests': {
'version': requests_version,
},
diff --git a/requests/models.py b/requests/models.py
index 2148024..4041cac 100644
--- a/requests/models.py
+++ b/requests/models.py
@@ -586,8 +586,6 @@ class Response(object):
]
def __init__(self):
- super(Response, self).__init__()
-
self._content = False
self._content_consumed = False
self._next = None
diff --git a/requests/sessions.py b/requests/sessions.py
index db91308..6570e73 100644
--- a/requests/sessions.py
+++ b/requests/sessions.py
@@ -97,6 +97,12 @@ class SessionRedirectMixin(object):
def get_redirect_target(self, resp):
"""Receives a Response. Returns a redirect URI or ``None``"""
+ # Due to the nature of how requests processes redirects this method will
+ # be called at least once upon the original response and at least twice
+ # on each subsequent redirect response (if any).
+ # If a custom mixin is used to handle this logic, it may be advantageous
+ # to cache the redirect location onto the response object as a private
+ # attribute.
if resp.is_redirect:
location = resp.headers['location']
# Currently the underlying http module on py3 decode headers
@@ -704,7 +710,7 @@ class Session(SessionRedirectMixin):
def mount(self, prefix, adapter):
"""Registers a connection adapter to a prefix.
- Adapters are sorted in descending order by key length.
+ Adapters are sorted in descending order by prefix length.
"""
self.adapters[prefix] = adapter
keys_to_move = [k for k in self.adapters if len(k) < len(prefix)]
diff --git a/requests/utils.py b/requests/utils.py
index 1e4960d..5c47de9 100644
--- a/requests/utils.py
+++ b/requests/utils.py
@@ -868,8 +868,8 @@ def check_header_validity(header):
if not pat.match(value):
raise InvalidHeader("Invalid return character or leading space in header: %s" % name)
except TypeError:
- raise InvalidHeader("Header value %s must be of type str or bytes, "
- "not %s" % (value, type(value)))
+ raise InvalidHeader("Value for header {%s: %s} must be of type str or "
+ "bytes, not %s" % (name, value, type(value)))
def urldefragauth(url):
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..8d79283
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,16 @@
+-e .[socks]
+pytest>=2.8.0
+codecov
+pytest-httpbin==0.0.7
+pytest-mock
+pytest-cov
+pytest-xdist
+alabaster
+readme_renderer
+Sphinx<=1.5.5
+PySocks
+setuptools>=18.5
+docutils
+flake8
+tox
+detox
diff --git a/setup.py b/setup.py
index 93a8507..ed4892d 100755
--- a/setup.py
+++ b/setup.py
@@ -43,8 +43,8 @@ packages = ['requests']
requires = [
'chardet>=3.0.2,<3.1.0',
- 'idna>=2.5,<2.6',
- 'urllib3>=1.21.1,<1.22',
+ 'idna>=2.5,<2.7',
+ 'urllib3>=1.21.1,<1.23',
'certifi>=2017.4.17'
]
@@ -83,7 +83,6 @@ setup(
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
diff --git a/tests/test_help.py b/tests/test_help.py
new file mode 100644
index 0000000..c11d43f
--- /dev/null
+++ b/tests/test_help.py
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8
+
+import sys
+
+import pytest
+
+from requests.help import info
+
+
+ at pytest.mark.skipif(sys.version_info[:2] != (2,6), reason="Only run on Python 2.6")
+def test_system_ssl_py26():
+ """OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't
+ blow up in this case.
+ """
+ assert info()['system_ssl'] == {'version': ''}
+
+
+ at pytest.mark.skipif(sys.version_info < (2,7), reason="Only run on Python 2.7+")
+def test_system_ssl():
+ """Verify we're actually setting system_ssl when it should be available."""
+ assert info()['system_ssl']['version'] != ''
+
+
+class VersionedPackage(object):
+ def __init__(self, version):
+ self.__version__ = version
+
+
+def test_idna_without_version_attribute(mocker):
+ """Older versions of IDNA don't provide a __version__ attribute, verify
+ that if we have such a package, we don't blow up.
+ """
+ mocker.patch('requests.help.idna', new=None)
+ assert info()['idna'] == {'version': ''}
+
+
+def test_idna_with_version_attribute(mocker):
+ """Verify we're actually setting idna version when it should be available."""
+ mocker.patch('requests.help.idna', new=VersionedPackage('2.6'))
+ assert info()['idna'] == {'version': '2.6'}
diff --git a/tests/test_requests.py b/tests/test_requests.py
index cfafc6e..a2b2213 100644
--- a/tests/test_requests.py
+++ b/tests/test_requests.py
@@ -23,7 +23,7 @@ from requests.cookies import (
from requests.exceptions import (
ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,
MissingSchema, ReadTimeout, Timeout, RetryError, TooManyRedirects,
- ProxyError, InvalidHeader, UnrewindableBodyError)
+ ProxyError, InvalidHeader, UnrewindableBodyError, SSLError)
from requests.models import PreparedRequest
from requests.structures import CaseInsensitiveDict
from requests.sessions import SessionRedirectMixin
@@ -812,6 +812,15 @@ class TestRequests:
item.category.__name__ for item in warning_records)
assert warnings_category == warnings_expected
+ def test_certificate_failure(self, httpbin_secure):
+ """
+ When underlying SSL problems occur, an SSLError is raised.
+ """
+ with pytest.raises(SSLError):
+ # Our local httpbin does not have a trusted CA, so this call will
+ # fail if we use our default trust bundle.
+ requests.get(httpbin_secure('status', '200'))
+
def test_urlencoded_get_query_multivalued_param(self, httpbin):
r = requests.get(httpbin('get'), params=dict(test=['foo', 'baz']))
@@ -1392,14 +1401,17 @@ class TestRequests:
headers_list = {'baz': ['foo', 'bar']}
# Test for int
- with pytest.raises(InvalidHeader):
+ with pytest.raises(InvalidHeader) as excinfo:
r = requests.get(httpbin('get'), headers=headers_int)
+ assert 'foo' in str(excinfo.value)
# Test for dict
- with pytest.raises(InvalidHeader):
+ with pytest.raises(InvalidHeader) as excinfo:
r = requests.get(httpbin('get'), headers=headers_dict)
+ assert 'bar' in str(excinfo.value)
# Test for list
- with pytest.raises(InvalidHeader):
+ with pytest.raises(InvalidHeader) as excinfo:
r = requests.get(httpbin('get'), headers=headers_list)
+ assert 'baz' in str(excinfo.value)
def test_header_no_return_chars(self, httpbin):
"""Ensure that a header containing return character sequences raise an
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/requests.git
More information about the Python-modules-commits
mailing list