Skip to content
Myr

Merge branch 'master' of https://github.com/requests/requests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents e5666b9, 554a210 · Browse files · 5 files+28 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+28 added−8 removed

  • tests:+10 added−3 removed
  • other:+18 added−5 removed

5 files+28 added−8 removed

modified:requests/__version__.py+2 added-2 removed
3 unmodified lines
45__title__ = 'requests'6__description__ = 'Python HTTP for Humans.'7__url__ = 'http://python-requests.org'8__version__ = '2.18.3'9__build__ = 0x0218038__version__ = '2.18.4'9__build__ = 0x02180410__author__ = 'Kenneth Reitz'11__author_email__ = 'me@kennethreitz.org'12__license__ = 'Apache 2.0'13__copyright__ = 'Copyright 2017 Kenneth Reitz'
1 unmodified line
modified:requests/utils.py+7 added-3 removed
741 unmodified lines
742 })743744745def parse_header_links(value):746 """Return a dict of parsed link headers proxies.746 """Return a list of parsed link headers proxies.747748 i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"749750 :rtype: list
2 unmodified lines
753 links = []754755 replace_chars = ' \'"'756757 value = value.strip(replace_chars)758 if not value:759 return links760761 for val in re.split(', *<', value):762 try:763 url, params = val.split(';', 1)764 except ValueError:
106 unmodified lines
871 try:872 if not pat.match(value):873 raise InvalidHeader("Invalid return character or leading space in header: %s" % name)874 except TypeError:871 raise InvalidHeader("Header value %s must be of type str or bytes, "872 "not %s" % (value, type(value)))875 raise InvalidHeader("Value for header {%s: %s} must be of type str or "876 "bytes, not %s" % (name, value, type(value)))877878879def urldefragauth(url):880 """
28 unmodified lines
modified:tests/test_requests.py+6 added-3 removed
1399 unmodified lines
1400 headers_dict = {'bar': {'foo': 'bar'}}1401 headers_list = {'baz': ['foo', 'bar']}14021403 # Test for int1404 with pytest.raises(InvalidHeader):1404 with pytest.raises(InvalidHeader) as excinfo:1405 r = requests.get(httpbin('get'), headers=headers_int)1406 assert 'foo' in str(excinfo.value)1407 # Test for dict1407 with pytest.raises(InvalidHeader):1408 with pytest.raises(InvalidHeader) as excinfo:1409 r = requests.get(httpbin('get'), headers=headers_dict)1410 assert 'bar' in str(excinfo.value)1411 # Test for list1410 with pytest.raises(InvalidHeader):1412 with pytest.raises(InvalidHeader) as excinfo:1413 r = requests.get(httpbin('get'), headers=headers_list)1414 assert 'baz' in str(excinfo.value)14151416 def test_header_no_return_chars(self, httpbin):1417 """Ensure that a header containing return character sequences raise an1418 exception. Otherwise, multiple headers are created from single string.
971 unmodified lines
modified:tests/test_utils.py+4 added
496 unmodified lines
497 {'url': 'http:/.../front.jpeg', 'type': 'image/jpeg'},498 {'url': 'http://.../back.jpeg'}499 ]500 ),501 (502 '',503 []504 ),505 ))506def test_parse_header_links(value, expected):507 assert parse_header_links(value) == expected508
176 unmodified lines
modified:HISTORY.rst+9 added
8 unmodified lines
9**Improvements**1011**Bugfixes**1213- Parsing empty ``Link`` headers with ``parse_header_links()`` no longer return one bogus entry14152.18.4 (2017-08-15)16+++++++++++++++++++1718**Improvements**1920- Error messages for invalid headers now include the header name for easier debugging2122**Dependencies**2324- We now support idna v2.6.25
1511 unmodified lines