Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-requests for openSUSE:Factory checked in at 2023-05-19 11:55:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-requests (Old) and /work/SRC/openSUSE:Factory/.python-requests.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-requests" Fri May 19 11:55:06 2023 rev:78 rq:1085070 version:2.30.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-requests/python-requests.changes 2023-03-04 22:42:25.131522279 +0100 +++ /work/SRC/openSUSE:Factory/.python-requests.new.1533/python-requests.changes 2023-05-19 11:55:25.819231894 +0200 @@ -1,0 +2,14 @@ +Fri May 5 12:03:42 UTC 2023 - Johannes Kastl <ka...@b1-systems.de> + +- add sle15_python_module_pythons + +------------------------------------------------------------------- +Thu May 4 01:49:01 UTC 2023 - Steve Kowalik <steven.kowa...@suse.com> + +- Update to 2.30.0: + * Added support for urllib3 2.0.  + * Defer chunked requests to the urllib3 implementation to improve + standardization. + * Relax header component requirements to support bytes/str subclasses. + +------------------------------------------------------------------- Old: ---- requests-2.28.2.tar.gz New: ---- requests-2.30.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-requests.spec ++++++ --- /var/tmp/diff_new_pack.5dt1X2/_old 2023-05-19 11:55:28.827249110 +0200 +++ /var/tmp/diff_new_pack.5dt1X2/_new 2023-05-19 11:55:28.835249156 +0200 @@ -24,13 +24,12 @@ %define psuffix %{nil} %bcond_with test %endif -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?sle15_python_module_pythons} Name: python-requests%{psuffix} -Version: 2.28.2 +Version: 2.30.0 Release: 0 Summary: Python HTTP Library License: Apache-2.0 -Group: Development/Languages/Python URL: https://docs.python-requests.org/ Source: https://files.pythonhosted.org/packages/source/r/requests/requests-%{version}.tar.gz # PATCH-FIX-UPSTREAM: Allow charset normalizer >=2 and <4, and don't strict require httpbin===1.0.0 ++++++ requests-2.28.2.tar.gz -> requests-2.30.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/HISTORY.md new/requests-2.30.0/HISTORY.md --- old/requests-2.28.2/HISTORY.md 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/HISTORY.md 2023-05-03 17:41:00.000000000 +0200 @@ -6,6 +6,26 @@ - \[Short description of non-trivial change.\] +2.30.0 (2023-05-03) +------------------- + +**Dependencies** +- â ï¸ Added support for urllib3 2.0. â ï¸ + + This may contain minor breaking changes so we advise careful testing and + reviewing https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html + prior to upgrading. + + Users who wish to stay on urllib3 1.x can pin to `urllib3<2`. + +2.29.0 (2023-04-26) +------------------- + +**Improvements** + +- Requests now defers chunked requests to the urllib3 implementation to improve + standardization. (#6226) +- Requests relaxes header component requirements to support bytes/str subclasses. (#6356) 2.28.2 (2023-01-12) ------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/PKG-INFO new/requests-2.30.0/PKG-INFO --- old/requests-2.28.2/PKG-INFO 2023-01-12 17:24:35.000000000 +0100 +++ new/requests-2.30.0/PKG-INFO 2023-05-03 17:43:34.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: requests -Version: 2.28.2 +Version: 2.30.0 Summary: Python HTTP for Humans. Home-page: https://requests.readthedocs.io Author: Kenneth Reitz @@ -106,7 +106,7 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Software Development :: Libraries -Requires-Python: >=3.7, <4 +Requires-Python: >=3.7 Description-Content-Type: text/markdown Provides-Extra: security Provides-Extra: socks diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/pyproject.toml new/requests-2.30.0/pyproject.toml --- old/requests-2.28.2/pyproject.toml 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/pyproject.toml 2023-05-03 17:41:00.000000000 +0200 @@ -4,7 +4,7 @@ honor_noqa = true [tool.pytest.ini_options] -addopts = "-p no:warnings --doctest-modules" +addopts = "--doctest-modules" doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS" minversion = "6.2" testpaths = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requests/__init__.py new/requests-2.30.0/requests/__init__.py --- old/requests-2.28.2/requests/__init__.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/requests/__init__.py 2023-05-03 17:41:00.000000000 +0200 @@ -66,10 +66,10 @@ # 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.26 - assert major == 1 - assert minor >= 21 - assert minor <= 26 + # urllib3 >= 1.21.1 + assert major >= 1 + if major == 1: + assert minor >= 21 # Check charset_normalizer for compatibility. if chardet_version: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requests/__version__.py new/requests-2.30.0/requests/__version__.py --- old/requests-2.28.2/requests/__version__.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/requests/__version__.py 2023-05-03 17:41:00.000000000 +0200 @@ -5,8 +5,8 @@ __title__ = "requests" __description__ = "Python HTTP for Humans." __url__ = "https://requests.readthedocs.io" -__version__ = "2.28.2" -__build__ = 0x022802 +__version__ = "2.30.0" +__build__ = 0x023000 __author__ = "Kenneth Reitz" __author_email__ = "m...@kennethreitz.org" __license__ = "Apache 2.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requests/_internal_utils.py new/requests-2.30.0/requests/_internal_utils.py --- old/requests-2.28.2/requests/_internal_utils.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/requests/_internal_utils.py 2023-05-03 17:41:00.000000000 +0200 @@ -14,9 +14,11 @@ _VALID_HEADER_VALUE_RE_BYTE = re.compile(rb"^\S[^\r\n]*$|^$") _VALID_HEADER_VALUE_RE_STR = re.compile(r"^\S[^\r\n]*$|^$") +_HEADER_VALIDATORS_STR = (_VALID_HEADER_NAME_RE_STR, _VALID_HEADER_VALUE_RE_STR) +_HEADER_VALIDATORS_BYTE = (_VALID_HEADER_NAME_RE_BYTE, _VALID_HEADER_VALUE_RE_BYTE) HEADER_VALIDATORS = { - bytes: (_VALID_HEADER_NAME_RE_BYTE, _VALID_HEADER_VALUE_RE_BYTE), - str: (_VALID_HEADER_NAME_RE_STR, _VALID_HEADER_VALUE_RE_STR), + bytes: _HEADER_VALIDATORS_BYTE, + str: _HEADER_VALIDATORS_STR, } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requests/adapters.py new/requests-2.30.0/requests/adapters.py --- old/requests-2.28.2/requests/adapters.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/requests/adapters.py 2023-05-03 17:41:00.000000000 +0200 @@ -22,7 +22,6 @@ from urllib3.exceptions import ReadTimeoutError, ResponseError from urllib3.exceptions import SSLError as _SSLError from urllib3.poolmanager import PoolManager, proxy_from_url -from urllib3.response import HTTPResponse from urllib3.util import Timeout as TimeoutSauce from urllib3.util import parse_url from urllib3.util.retry import Retry @@ -194,7 +193,6 @@ num_pools=connections, maxsize=maxsize, block=block, - strict=True, **pool_kwargs, ) @@ -485,63 +483,19 @@ timeout = TimeoutSauce(connect=timeout, read=timeout) try: - if not chunked: - resp = conn.urlopen( - method=request.method, - url=url, - body=request.body, - headers=request.headers, - redirect=False, - assert_same_host=False, - preload_content=False, - decode_content=False, - retries=self.max_retries, - timeout=timeout, - ) - - # Send the request. - else: - if hasattr(conn, "proxy_pool"): - conn = conn.proxy_pool - - low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT) - - try: - skip_host = "Host" in request.headers - low_conn.putrequest( - request.method, - url, - skip_accept_encoding=True, - skip_host=skip_host, - ) - - for header, value in request.headers.items(): - low_conn.putheader(header, value) - - low_conn.endheaders() - - for i in request.body: - low_conn.send(hex(len(i))[2:].encode("utf-8")) - low_conn.send(b"\r\n") - low_conn.send(i) - low_conn.send(b"\r\n") - low_conn.send(b"0\r\n\r\n") - - # Receive the response from the server - r = low_conn.getresponse() - - resp = HTTPResponse.from_httplib( - r, - pool=conn, - connection=low_conn, - preload_content=False, - decode_content=False, - ) - except Exception: - # If we hit any problems here, clean up the connection. - # Then, raise so that we can handle the actual exception. - low_conn.close() - raise + resp = conn.urlopen( + method=request.method, + url=url, + body=request.body, + headers=request.headers, + redirect=False, + assert_same_host=False, + preload_content=False, + decode_content=False, + retries=self.max_retries, + timeout=timeout, + chunked=chunked, + ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requests/api.py new/requests-2.30.0/requests/api.py --- old/requests-2.28.2/requests/api.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/requests/api.py 2023-05-03 17:41:00.000000000 +0200 @@ -106,7 +106,7 @@ :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. - :param json: (optional) json data to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response @@ -121,7 +121,7 @@ :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. - :param json: (optional) json data to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response @@ -136,7 +136,7 @@ :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. - :param json: (optional) json data to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requests/utils.py new/requests-2.30.0/requests/utils.py --- old/requests-2.28.2/requests/utils.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/requests/utils.py 2023-05-03 17:41:00.000000000 +0200 @@ -25,7 +25,12 @@ from .__version__ import __version__ # to_native_string is unused here, but imported here for backwards compatibility -from ._internal_utils import HEADER_VALIDATORS, to_native_string # noqa: F401 +from ._internal_utils import ( # noqa: F401 + _HEADER_VALIDATORS_BYTE, + _HEADER_VALIDATORS_STR, + HEADER_VALIDATORS, + to_native_string, +) from .compat import ( Mapping, basestring, @@ -1031,20 +1036,23 @@ :param header: tuple, in the format (name, value). """ name, value = header + _validate_header_part(header, name, 0) + _validate_header_part(header, value, 1) - for part in header: - if type(part) not in HEADER_VALIDATORS: - raise InvalidHeader( - f"Header part ({part!r}) from {{{name!r}: {value!r}}} must be " - f"of type str or bytes, not {type(part)}" - ) - - _validate_header_part(name, "name", HEADER_VALIDATORS[type(name)][0]) - _validate_header_part(value, "value", HEADER_VALIDATORS[type(value)][1]) +def _validate_header_part(header, header_part, header_validator_index): + if isinstance(header_part, str): + validator = _HEADER_VALIDATORS_STR[header_validator_index] + elif isinstance(header_part, bytes): + validator = _HEADER_VALIDATORS_BYTE[header_validator_index] + else: + raise InvalidHeader( + f"Header part ({header_part!r}) from {header} " + f"must be of type str or bytes, not {type(header_part)}" + ) -def _validate_header_part(header_part, header_kind, validator): if not validator.match(header_part): + header_kind = "name" if header_validator_index == 0 else "value" raise InvalidHeader( f"Invalid leading whitespace, reserved character(s), or return" f"character(s) in header {header_kind}: {header_part!r}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requests.egg-info/PKG-INFO new/requests-2.30.0/requests.egg-info/PKG-INFO --- old/requests-2.28.2/requests.egg-info/PKG-INFO 2023-01-12 17:24:34.000000000 +0100 +++ new/requests-2.30.0/requests.egg-info/PKG-INFO 2023-05-03 17:43:34.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: requests -Version: 2.28.2 +Version: 2.30.0 Summary: Python HTTP for Humans. Home-page: https://requests.readthedocs.io Author: Kenneth Reitz @@ -106,7 +106,7 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Software Development :: Libraries -Requires-Python: >=3.7, <4 +Requires-Python: >=3.7 Description-Content-Type: text/markdown Provides-Extra: security Provides-Extra: socks diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requests.egg-info/requires.txt new/requests-2.30.0/requests.egg-info/requires.txt --- old/requests-2.28.2/requests.egg-info/requires.txt 2023-01-12 17:24:34.000000000 +0100 +++ new/requests-2.30.0/requests.egg-info/requires.txt 2023-05-03 17:43:34.000000000 +0200 @@ -1,6 +1,6 @@ charset_normalizer<4,>=2 idna<4,>=2.5 -urllib3<1.27,>=1.21.1 +urllib3<3,>=1.21.1 certifi>=2017.4.17 [security] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/requirements-dev.txt new/requests-2.30.0/requirements-dev.txt --- old/requests-2.28.2/requirements-dev.txt 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/requirements-dev.txt 2023-05-03 17:41:00.000000000 +0200 @@ -6,6 +6,7 @@ httpbin==0.7.0 trustme wheel +cryptography<40.0.0; python_version <= '3.7' and platform_python_implementation == 'PyPy' # Flask Stack Flask>1.0,<2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/setup.py new/requests-2.30.0/setup.py --- old/requests-2.28.2/setup.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/setup.py 2023-05-03 17:41:00.000000000 +0200 @@ -61,7 +61,7 @@ requires = [ "charset_normalizer>=2,<4", "idna>=2.5,<4", - "urllib3>=1.21.1,<1.27", + "urllib3>=1.21.1,<3", "certifi>=2017.4.17", ] test_requirements = [ @@ -94,7 +94,7 @@ package_data={"": ["LICENSE", "NOTICE"]}, package_dir={"requests": "requests"}, include_package_data=True, - python_requires=">=3.7, <4", + python_requires=">=3.7", install_requires=requires, license=about["__license__"], zip_safe=False, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/tests/__init__.py new/requests-2.30.0/tests/__init__.py --- old/requests-2.28.2/tests/__init__.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/tests/__init__.py 2023-05-03 17:41:00.000000000 +0200 @@ -2,9 +2,13 @@ import warnings -from urllib3.exceptions import SNIMissingWarning +try: + from urllib3.exceptions import SNIMissingWarning -# urllib3 sets SNIMissingWarning to only go off once, -# while this test suite requires it to always fire -# so that it occurs during test_requests.test_https_warnings -warnings.simplefilter("always", SNIMissingWarning) + # urllib3 1.x sets SNIMissingWarning to only go off once, + # while this test suite requires it to always fire + # so that it occurs during test_requests.test_https_warnings + warnings.simplefilter("always", SNIMissingWarning) +except ImportError: + # urllib3 2.0 removed that warning and errors out instead + SNIMissingWarning = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.28.2/tests/test_requests.py new/requests-2.30.0/tests/test_requests.py --- old/requests-2.28.2/tests/test_requests.py 2023-01-12 17:16:59.000000000 +0100 +++ new/requests-2.30.0/tests/test_requests.py 2023-05-03 17:41:00.000000000 +0200 @@ -48,6 +48,7 @@ from requests.sessions import SessionRedirectMixin from requests.structures import CaseInsensitiveDict +from . import SNIMissingWarning from .compat import StringIO from .utils import override_environ @@ -974,6 +975,10 @@ r = requests.get(httpbin(), cert=".") assert r.status_code == 200 + @pytest.mark.skipif( + SNIMissingWarning is None, + reason="urllib3 2.0 removed that warning and errors out instead", + ) def test_https_warnings(self, nosan_server): """warnings are emitted with requests.get""" host, port, ca_bundle = nosan_server @@ -1747,6 +1752,31 @@ with pytest.raises(InvalidHeader): requests.get(httpbin("get"), headers=invalid_header) + def test_header_with_subclass_types(self, httpbin): + """If the subclasses does not behave *exactly* like + the base bytes/str classes, this is not supported. + This test is for backwards compatibility. + """ + + class MyString(str): + pass + + class MyBytes(bytes): + pass + + r_str = requests.get(httpbin("get"), headers={MyString("x-custom"): "myheader"}) + assert r_str.request.headers["x-custom"] == "myheader" + + r_bytes = requests.get( + httpbin("get"), headers={MyBytes(b"x-custom"): b"myheader"} + ) + assert r_bytes.request.headers["x-custom"] == b"myheader" + + r_mixed = requests.get( + httpbin("get"), headers={MyString("x-custom"): MyBytes(b"myheader")} + ) + assert r_mixed.request.headers["x-custom"] == b"myheader" + @pytest.mark.parametrize("files", ("foo", b"foo", bytearray(b"foo"))) def test_can_send_objects_with_files(self, httpbin, files): data = {"a": "this is a string"}