Merge branch 'master' into doc-import
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kelley Robinson · committed by GitHub · parents d758f0c, f78a579 · Browse files · 11 files·+61 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
11 files+61 added−16 removed
- tests:+29 added−1 removed
- other:+32 added−15 removed
Provenance
- Commit
f6952a9- Tree
6cd10ac- Author
Kelley Robinson <robinske@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent 1
d758f0c- Parent 2
f78a579
11 files changed+61 added−16 removed
modified:docs/user/advanced.rst+2 added
591 unmodified lines592 'http': 'socks5://user:pass@host:port',593 'https': 'socks5://user:pass@host:port'594 }595 596+Using the scheme ``socks5`` causes the DNS resolution to happen on the client, rather than on the proxy server. This is in line with curl, which uses the scheme to decide whether to do the DNS resolution on the client or proxy. If you want to resolve the domains on the proxy server, use ``socks5h`` as the scheme.597+598 .. _compliance:599 600 Compliance601 ----------389 unmodified linesmodified:requests/__version__.py+2 added-2 removed
3 unmodified lines4 5 __title__ = 'requests'6 __description__ = 'Python HTTP for Humans.'7 __url__ = 'http://python-requests.org'8-__version__ = '2.18.2'9-__build__ = 0x0218028+__version__ = '2.18.3'9+__build__ = 0x02180310 __author__ = 'Kenneth Reitz'11 __author_email__ = 'me@kennethreitz.org'12 __license__ = 'Apache 2.0'13 __copyright__ = 'Copyright 2017 Kenneth Reitz'1 unmodified linemodified:requests/adapters.py+5 added
499 unmodified lines500 501 if isinstance(e.reason, _ProxyError):502 raise ProxyError(e, request=request)503 504+ if isinstance(e.reason, _SSLError):505+ # This branch is for urllib3 v1.22 and later.506+ raise SSLError(e, request=request)507+508 raise ConnectionError(e, request=request)509 510 except ClosedPoolError as e:511 raise ConnectionError(e, request=request)2 unmodified lines514 raise ProxyError(e)515 516 except (_SSLError, _HTTPError) as e:517 if isinstance(e, _SSLError):518+ # This branch is for urllib3 versions earlier than v1.22519 raise SSLError(e, request=request)520 elif isinstance(e, ReadTimeoutError):521 raise ReadTimeout(e, request=request)522 else:3 unmodified linesmodified:requests/compat.py+1 added-3 removed
25 unmodified lines26 is_py3 = (_ver[0] == 3)27 28 try:29 import simplejson as json30-except (ImportError, SyntaxError):31- # simplejson does not support Python 3.2, it throws a SyntaxError32- # because of u'...' Unicode literals.30+except ImportError:31 import json32 33 # ---------34 # Specifics35 unmodified linesmodified:requests/help.py+5 added
4 unmodified lines5 import platform6 import sys7 import ssl8 9+import idna10 import urllib311 import chardet12 13 from . import __version__ as requests_version70 unmodified lines84 }85 cryptography_info = {86 'version': getattr(cryptography, '__version__', ''),87 }88+ idna_info = {89+ 'version': getattr(idna, '__version__', ''),90+ }91 92 # OPENSSL_VERSION_NUMBER doesn't exist in the Python 2.6 ssl module.93 system_ssl = getattr(ssl, 'OPENSSL_VERSION_NUMBER', None)94 system_ssl_info = {8 unmodified lines103 'pyOpenSSL': pyopenssl_info,104 'urllib3': urllib3_info,105 'chardet': chardet_info,106 'cryptography': cryptography_info,107+ 'idna': idna_info,108 'requests': {109 'version': requests_version,110 },111 }9 unmodified linesmodified:requests/models.py-2 removed
584 unmodified lines585 'encoding', 'reason', 'cookies', 'elapsed', 'request'586 ]587 588 def __init__(self):589- super(Response, self).__init__()590-589 self._content = False590 self._content_consumed = False591 self._next = None592 356 unmodified linesmodified:tests/test_help.py+19 added
17 unmodified lines18 @pytest.mark.skipif(sys.version_info < (2,7), reason="Only run on Python 2.7+")19 def test_system_ssl():20 """Verify we're actually setting system_ssl when it should be available."""21 assert info()['system_ssl']['version'] != ''22+23+24+class VersionedPackage(object):25+ def __init__(self, version):26+ self.__version__ = version27+28+29+def test_idna_without_version_attribute(mocker):30+ """Older versions of IDNA don't provide a __version__ attribute, verify31+ that if we have such a package, we don't blow up.32+ """33+ mocker.patch('requests.help.idna', new=None)34+ assert info()['idna'] == {'version': ''}35+36+37+def test_idna_with_version_attribute(mocker):38+ """Verify we're actually setting idna version when it should be available."""39+ mocker.patch('requests.help.idna', new=VersionedPackage('2.6'))40+ assert info()['idna'] == {'version': '2.6'}modified:tests/test_requests.py+10 added-1 removed
21 unmodified lines22 cookiejar_from_dict, morsel_to_cookie)23 from requests.exceptions import (24 ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,25 MissingSchema, ReadTimeout, Timeout, RetryError, TooManyRedirects,26- ProxyError, InvalidHeader, UnrewindableBodyError)26+ ProxyError, InvalidHeader, UnrewindableBodyError, SSLError)27 from requests.models import PreparedRequest28 from requests.structures import CaseInsensitiveDict29 from requests.sessions import SessionRedirectMixin30 from requests.models import urlencode780 unmodified lines811 warnings_category = tuple(812 item.category.__name__ for item in warning_records)813 assert warnings_category == warnings_expected814 815+ def test_certificate_failure(self, httpbin_secure):816+ """817+ When underlying SSL problems occur, an SSLError is raised.818+ """819+ with pytest.raises(SSLError):820+ # Our local httpbin does not have a trusted CA, so this call will821+ # fail if we use our default trust bundle.822+ requests.get(httpbin_secure('status', '200'))823+824 def test_urlencoded_get_query_multivalued_param(self, httpbin):825 826 r = requests.get(httpbin('get'), params=dict(test=['foo', 'baz']))827 assert r.status_code == 2001559 unmodified linesmodified:AUTHORS.rst-7 removed
8 unmodified lines9 - Ian Cordasco <graffatcolmingov@gmail.com> `@sigmavirus24 <https://github.com/sigmavirus24>`_10 - Nate Prewitt <nate.prewitt@gmail.com> `@nateprewitt <https://github.com/nateprewitt>`_11 12 13-14-Urllib315-```````16-17-- Andrey Petrov <andrey.petrov@shazow.net>18-19-13 Patches and Suggestions14 ```````````````````````15 16 - Various Pocoo Members164 unmodified linesmodified:HISTORY.rst+16 added
8 unmodified lines9 **Improvements**10 11 **Bugfixes**12 13+**Dependencies**14+15+- We now support idna v2.6.16+17+2.18.3 (2017-08-02)18++++++++++++++++++++19+20+**Improvements**21+22+- Running ``$ python -m requests.help`` now includes the installed version of idna.23+24+**Bugfixes**25+26+- Fixed issue where Requests would raise ``ConnectionError`` instead of27+ ``SSLError`` when encountering SSL problems when using urllib3 v1.22.28+29 2.18.2 (2017-07-25)30 +++++++++++++++++++31 32 **Bugfixes**1495 unmodified linesmodified:setup.py+1 added-1 removed
41 unmodified lines42 packages = ['requests']43 44 requires = [45 'chardet>=3.0.2,<3.1.0',46- 'idna>=2.5,<2.6',46+ 'idna>=2.5,<2.7',47 'urllib3>=1.21.1,<1.23',48 'certifi>=2017.4.17'49 50 ]51 unmodified lines