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 2021-11-21 23:51:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-requests (Old)
and /work/SRC/openSUSE:Factory/.python-requests.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-requests"
Sun Nov 21 23:51:34 2021 rev:71 rq:928315 version:2.26.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-requests/python-requests.changes
2021-07-10 22:54:01.851976943 +0200
+++
/work/SRC/openSUSE:Factory/.python-requests.new.1895/python-requests.changes
2021-11-21 23:51:41.346348295 +0100
@@ -1,0 +2,23 @@
+Thu Oct 28 06:55:31 UTC 2021 - Steve Kowalik <[email protected]>
+
+- Correct {Build,}Requires for charset_normalizer.
+- Add trustme to BuildRequires for the test suite.
+
+-------------------------------------------------------------------
+Tue Oct 26 21:08:01 UTC 2021 - Dirk M??ller <[email protected]>
+
+- update to 2.26.0:
+ - `Session.send` now correctly resolves proxy configurations from both
+ the Session and Request. Behavior now matches `Session.request`. (#5681)
+ - Fixed a race condition in zip extraction when using Requests in parallel
+ from zip archive. (#5707)
+ - Instead of `chardet`, use the MIT-licensed `charset_normalizer` for Python3
+ to remove license ambiguity for projects bundling requests.
+ - Requests now supports `idna` 3.x on Python 3. `idna` 2.x will continue to
+ be used on Python 2 installations. (#5711)
+ - The `requests[security]` extra has been converted to a no-op install.
+ PyOpenSSL is no longer the recommended secure option for Requests. (#5867)
+ - Requests has officially dropped support for Python 3.5. (#5867)
+- drop 5711.patch: upstream
+
+-------------------------------------------------------------------
Old:
----
5711.patch
requests-2.25.1.tar.gz
New:
----
requests-2.26.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-requests.spec ++++++
--- /var/tmp/diff_new_pack.Kci3eF/_old 2021-11-21 23:51:42.638344130 +0100
+++ /var/tmp/diff_new_pack.Kci3eF/_new 2021-11-21 23:51:42.638344130 +0100
@@ -26,7 +26,7 @@
%endif
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-requests%{psuffix}
-Version: 2.25.1
+Version: 2.26.0
Release: 0
Summary: Python HTTP Library
License: Apache-2.0
@@ -35,15 +35,13 @@
Source:
https://files.pythonhosted.org/packages/source/r/requests/requests-%{version}.tar.gz
# PATCH-FIX-SUSE: do not hardcode versions in setup.py/requirements
Patch0: requests-no-hardcoded-version.patch
-# PATCH-FIX-UPSTREAM: gh#psf/requests#5711
-Patch1:
https://patch-diff.githubusercontent.com/raw/psf/requests/pull/5711.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: ca-certificates
Requires: python
Requires: python-certifi >= 2017.4.17
-Requires: python-chardet >= 3.0.2
+Requires: python-charset-normalizer >= 2.0.0
Requires: python-idna >= 2.5
Requires: python-py
Requires: python-urllib3 >= 1.21.1
@@ -62,12 +60,13 @@
%if %{with test}
BuildRequires: %{python_module PySocks >= 1.5.6}
BuildRequires: %{python_module brotlipy}
-BuildRequires: %{python_module chardet >= 3.0.2}
+BuildRequires: %{python_module charset-normalizer >= 2.0.0}
BuildRequires: %{python_module idna >= 2.5}
BuildRequires: %{python_module pytest-httpbin >= 0.0.7}
BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests >= %{version}}
+BuildRequires: %{python_module trustme}
%endif
%python_subpackages
++++++ requests-2.25.1.tar.gz -> requests-2.26.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/HISTORY.md
new/requests-2.26.0/HISTORY.md
--- old/requests-2.25.1/HISTORY.md 2020-12-16 20:36:58.000000000 +0100
+++ new/requests-2.26.0/HISTORY.md 2021-07-13 16:52:57.000000000 +0200
@@ -6,6 +6,48 @@
- \[Short description of non-trivial change.\]
+2.26.0 (2021-07-13)
+-------------------
+
+**Improvements**
+
+- Requests now supports Brotli compression, if either the `brotli` or
+ `brotlicffi` package is installed. (#5783)
+
+- `Session.send` now correctly resolves proxy configurations from both
+ the Session and Request. Behavior now matches `Session.request`. (#5681)
+
+**Bugfixes**
+
+- Fixed a race condition in zip extraction when using Requests in parallel
+ from zip archive. (#5707)
+
+**Dependencies**
+
+- Instead of `chardet`, use the MIT-licensed `charset_normalizer` for Python3
+ to remove license ambiguity for projects bundling requests. If `chardet`
+ is already installed on your machine it will be used instead of
`charset_normalizer`
+ to keep backwards compatibility. (#5797)
+
+ You can also install `chardet` while installing requests by
+ specifying `[use_chardet_on_py3]` extra as follows:
+
+ ```shell
+ pip install "requests[use_chardet_on_py3]"
+ ```
+
+ Python2 still depends upon the `chardet` module.
+
+- Requests now supports `idna` 3.x on Python 3. `idna` 2.x will continue to
+ be used on Python 2 installations. (#5711)
+
+**Deprecations**
+
+- The `requests[security]` extra has been converted to a no-op install.
+ PyOpenSSL is no longer the recommended secure option for Requests. (#5867)
+
+- Requests has officially dropped support for Python 3.5. (#5867)
+
2.25.1 (2020-12-16)
-------------------
@@ -1707,4 +1749,3 @@
- Frustration
- Conception
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/PKG-INFO new/requests-2.26.0/PKG-INFO
--- old/requests-2.25.1/PKG-INFO 2020-12-16 20:37:50.000000000 +0100
+++ new/requests-2.26.0/PKG-INFO 2021-07-13 16:54:32.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: requests
-Version: 2.25.1
+Version: 2.26.0
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
@@ -10,7 +10,7 @@
Project-URL: Source, https://github.com/psf/requests
Description: # Requests
- **Requests** is a simple, yet elegant HTTP library.
+ **Requests** is a simple, yet elegant, HTTP library.
```python
>>> import requests
@@ -43,7 +43,7 @@
$ python -m pip install requests
```
- Requests officially supports Python 2.7 & 3.5+.
+ Requests officially supports Python 2.7 & 3.6+.
## Supported Features & Best???Practices
@@ -67,6 +67,22 @@
[](https://requests.readthedocs.io)
+ ## Cloning the repository
+
+ When cloning the Requests repository, you may need to add the `-c
+ fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad
commit (see
+ [this issue](https://github.com/psf/requests/issues/2690) for more
background):
+
+ ```shell
+ git clone -c fetch.fsck.badTimezone=ignore
https://github.com/psf/requests.git
+ ```
+
+ You can also apply this setting to your global Git config:
+
+ ```shell
+ git config --global fetch.fsck.badTimezone ignore
+ ```
+
---
[](https://kennethreitz.org)
[](https://www.python.org/psf)
@@ -80,14 +96,14 @@
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
Description-Content-Type: text/markdown
Provides-Extra: security
Provides-Extra: socks
+Provides-Extra: use_chardet_on_py3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/README.md
new/requests-2.26.0/README.md
--- old/requests-2.25.1/README.md 2020-12-11 05:36:00.000000000 +0100
+++ new/requests-2.26.0/README.md 2021-07-13 16:52:57.000000000 +0200
@@ -1,6 +1,6 @@
# Requests
-**Requests** is a simple, yet elegant HTTP library.
+**Requests** is a simple, yet elegant, HTTP library.
```python
>>> import requests
@@ -33,7 +33,7 @@
$ python -m pip install requests
```
-Requests officially supports Python 2.7 & 3.5+.
+Requests officially supports Python 2.7 & 3.6+.
## Supported Features & Best???Practices
@@ -57,6 +57,22 @@
[](https://requests.readthedocs.io)
+## Cloning the repository
+
+When cloning the Requests repository, you may need to add the `-c
+fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad commit (see
+[this issue](https://github.com/psf/requests/issues/2690) for more background):
+
+```shell
+git clone -c fetch.fsck.badTimezone=ignore https://github.com/psf/requests.git
+```
+
+You can also apply this setting to your global Git config:
+
+```shell
+git config --global fetch.fsck.badTimezone ignore
+```
+
---
[](https://kennethreitz.org)
[](https://www.python.org/psf)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/__init__.py
new/requests-2.26.0/requests/__init__.py
--- old/requests-2.25.1/requests/__init__.py 2020-12-16 18:43:25.000000000
+0100
+++ new/requests-2.26.0/requests/__init__.py 2021-07-13 00:29:50.000000000
+0200
@@ -41,12 +41,20 @@
"""
import urllib3
-import chardet
import warnings
from .exceptions import RequestsDependencyWarning
+try:
+ from charset_normalizer import __version__ as charset_normalizer_version
+except ImportError:
+ charset_normalizer_version = None
+
+try:
+ from chardet import __version__ as chardet_version
+except ImportError:
+ chardet_version = None
-def check_compatibility(urllib3_version, chardet_version):
+def check_compatibility(urllib3_version, chardet_version,
charset_normalizer_version):
urllib3_version = urllib3_version.split('.')
assert urllib3_version != ['dev'] # Verify urllib3 isn't installed from
git.
@@ -62,12 +70,19 @@
assert minor >= 21
assert minor <= 26
- # Check chardet for compatibility.
- major, minor, patch = chardet_version.split('.')[:3]
- major, minor, patch = int(major), int(minor), int(patch)
- # chardet >= 3.0.2, < 5.0.0
- assert (3, 0, 2) <= (major, minor, patch) < (5, 0, 0)
-
+ # Check charset_normalizer for compatibility.
+ if chardet_version:
+ major, minor, patch = chardet_version.split('.')[:3]
+ major, minor, patch = int(major), int(minor), int(patch)
+ # chardet_version >= 3.0.2, < 5.0.0
+ assert (3, 0, 2) <= (major, minor, patch) < (5, 0, 0)
+ elif charset_normalizer_version:
+ major, minor, patch = charset_normalizer_version.split('.')[:3]
+ major, minor, patch = int(major), int(minor), int(patch)
+ # charset_normalizer >= 2.0.0 < 3.0.0
+ assert (2, 0, 0) <= (major, minor, patch) < (3, 0, 0)
+ else:
+ raise Exception("You need either charset_normalizer or chardet
installed")
def _check_cryptography(cryptography_version):
# cryptography < 1.3.4
@@ -82,10 +97,10 @@
# Check imported dependencies for compatibility.
try:
- check_compatibility(urllib3.__version__, chardet.__version__)
+ check_compatibility(urllib3.__version__, chardet_version,
charset_normalizer_version)
except (AssertionError, ValueError):
- warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
- "version!".format(urllib3.__version__, chardet.__version__),
+ warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({})
doesn't match a supported "
+ "version!".format(urllib3.__version__, chardet_version,
charset_normalizer_version),
RequestsDependencyWarning)
# Attempt to enable urllib3's fallback for SNI support
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/__version__.py
new/requests-2.26.0/requests/__version__.py
--- old/requests-2.25.1/requests/__version__.py 2020-12-16 20:36:58.000000000
+0100
+++ new/requests-2.26.0/requests/__version__.py 2021-07-13 16:52:57.000000000
+0200
@@ -5,8 +5,8 @@
__title__ = 'requests'
__description__ = 'Python HTTP for Humans.'
__url__ = 'https://requests.readthedocs.io'
-__version__ = '2.25.1'
-__build__ = 0x022501
+__version__ = '2.26.0'
+__build__ = 0x022600
__author__ = 'Kenneth Reitz'
__author_email__ = '[email protected]'
__license__ = 'Apache 2.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/api.py
new/requests-2.26.0/requests/api.py
--- old/requests-2.25.1/requests/api.py 2020-12-11 05:36:00.000000000 +0100
+++ new/requests-2.26.0/requests/api.py 2021-07-09 19:35:18.000000000 +0200
@@ -72,7 +72,6 @@
:rtype: requests.Response
"""
- kwargs.setdefault('allow_redirects', True)
return request('get', url, params=params, **kwargs)
@@ -85,7 +84,6 @@
:rtype: requests.Response
"""
- kwargs.setdefault('allow_redirects', True)
return request('options', url, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/compat.py
new/requests-2.26.0/requests/compat.py
--- old/requests-2.25.1/requests/compat.py 2020-12-11 05:36:00.000000000
+0100
+++ new/requests-2.26.0/requests/compat.py 2021-07-13 00:29:50.000000000
+0200
@@ -8,7 +8,10 @@
Python 3.
"""
-import chardet
+try:
+ import chardet
+except ImportError:
+ import charset_normalizer as chardet
import sys
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/exceptions.py
new/requests-2.26.0/requests/exceptions.py
--- old/requests-2.25.1/requests/exceptions.py 2020-12-11 05:36:00.000000000
+0100
+++ new/requests-2.26.0/requests/exceptions.py 2021-07-13 00:29:50.000000000
+0200
@@ -25,6 +25,10 @@
super(RequestException, self).__init__(*args, **kwargs)
+class InvalidJSONError(RequestException):
+ """A JSON error occurred."""
+
+
class HTTPError(RequestException):
"""An HTTP error occurred."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/help.py
new/requests-2.26.0/requests/help.py
--- old/requests-2.25.1/requests/help.py 2020-12-11 05:36:00.000000000
+0100
+++ new/requests-2.26.0/requests/help.py 2021-07-09 19:35:18.000000000
+0200
@@ -8,11 +8,20 @@
import idna
import urllib3
-import chardet
from . import __version__ as requests_version
try:
+ import charset_normalizer
+except ImportError:
+ charset_normalizer = None
+
+try:
+ import chardet
+except ImportError:
+ chardet = None
+
+try:
from urllib3.contrib import pyopenssl
except ImportError:
pyopenssl = None
@@ -71,7 +80,12 @@
implementation_info = _implementation()
urllib3_info = {'version': urllib3.__version__}
- chardet_info = {'version': chardet.__version__}
+ charset_normalizer_info = {'version': None}
+ chardet_info = {'version': None}
+ if charset_normalizer:
+ charset_normalizer_info = {'version': charset_normalizer.__version__}
+ if chardet:
+ chardet_info = {'version': chardet.__version__}
pyopenssl_info = {
'version': None,
@@ -99,9 +113,11 @@
'implementation': implementation_info,
'system_ssl': system_ssl_info,
'using_pyopenssl': pyopenssl is not None,
+ 'using_charset_normalizer': chardet is None,
'pyOpenSSL': pyopenssl_info,
'urllib3': urllib3_info,
'chardet': chardet_info,
+ 'charset_normalizer': charset_normalizer_info,
'cryptography': cryptography_info,
'idna': idna_info,
'requests': {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/models.py
new/requests-2.26.0/requests/models.py
--- old/requests-2.25.1/requests/models.py 2020-12-11 05:36:00.000000000
+0100
+++ new/requests-2.26.0/requests/models.py 2021-07-13 00:29:50.000000000
+0200
@@ -29,7 +29,7 @@
from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar
from .exceptions import (
HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,
- ContentDecodingError, ConnectionError, StreamConsumedError)
+ ContentDecodingError, ConnectionError, StreamConsumedError,
InvalidJSONError)
from ._internal_utils import to_native_string, unicode_is_ascii
from .utils import (
guess_filename, get_auth_from_url, requote_uri,
@@ -466,7 +466,12 @@
# urllib3 requires a bytes-like body. Python 2's json.dumps
# provides this natively, but Python 3 gives a Unicode string.
content_type = 'application/json'
- body = complexjson.dumps(json)
+
+ try:
+ body = complexjson.dumps(json, allow_nan=False)
+ except ValueError as ve:
+ raise InvalidJSONError(ve, request=self)
+
if not isinstance(body, bytes):
body = body.encode('utf-8')
@@ -726,7 +731,7 @@
@property
def apparent_encoding(self):
- """The apparent encoding, provided by the chardet library."""
+ """The apparent encoding, provided by the charset_normalizer or
chardet libraries."""
return chardet.detect(self.content)['encoding']
def iter_content(self, chunk_size=1, decode_unicode=False):
@@ -840,7 +845,7 @@
"""Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
- ``chardet``.
+ ``charset_normalizer`` or ``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
@@ -877,13 +882,18 @@
r"""Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
- :raises ValueError: If the response body does not contain valid json.
+ :raises simplejson.JSONDecodeError: If the response body does not
+ contain valid json and simplejson is installed.
+ :raises json.JSONDecodeError: If the response body does not contain
+ valid json and simplejson is not installed on Python 3.
+ :raises ValueError: If the response body does not contain valid
+ json and simplejson is not installed on Python 2.
"""
if not self.encoding and self.content and len(self.content) > 3:
# No encoding set. JSON RFC 4627 section 3 states we should expect
# UTF-8, -16 or -32. Detect which one to use; If the detection or
- # decoding fails, fall back to `self.text` (using chardet to make
+ # decoding fails, fall back to `self.text` (using
charset_normalizer to make
# a best guess).
encoding = guess_json_utf(self.content)
if encoding is not None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/packages.py
new/requests-2.26.0/requests/packages.py
--- old/requests-2.25.1/requests/packages.py 2020-12-11 05:36:00.000000000
+0100
+++ new/requests-2.26.0/requests/packages.py 2021-07-09 19:35:18.000000000
+0200
@@ -1,9 +1,17 @@
import sys
+try:
+ import chardet
+except ImportError:
+ import charset_normalizer as chardet
+ import warnings
+
+ warnings.filterwarnings('ignore', 'Trying to detect',
module='charset_normalizer')
+
# This code exists for backwards compatibility reasons.
# I don't like it either. Just look the other way. :)
-for package in ('urllib3', 'idna', 'chardet'):
+for package in ('urllib3', 'idna'):
locals()[package] = __import__(package)
# This traversal is apparently necessary such that the identities are
# preserved (requests.packages.urllib3.* is urllib3.*)
@@ -11,4 +19,8 @@
if mod == package or mod.startswith(package + '.'):
sys.modules['requests.packages.' + mod] = sys.modules[mod]
+target = chardet.__name__
+for mod in list(sys.modules):
+ if mod == target or mod.startswith(target + '.'):
+ sys.modules['requests.packages.' + target.replace(target, 'chardet')]
= sys.modules[mod]
# Kinda cool, though, right?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/sessions.py
new/requests-2.26.0/requests/sessions.py
--- old/requests-2.25.1/requests/sessions.py 2020-12-16 18:43:25.000000000
+0100
+++ new/requests-2.26.0/requests/sessions.py 2021-07-09 19:35:18.000000000
+0200
@@ -633,7 +633,7 @@
kwargs.setdefault('stream', self.stream)
kwargs.setdefault('verify', self.verify)
kwargs.setdefault('cert', self.cert)
- kwargs.setdefault('proxies', self.proxies)
+ kwargs.setdefault('proxies', self.rebuild_proxies(request,
self.proxies))
# It's possible that users might accidentally send a Request object.
# Guard against that specific failure case.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests/utils.py
new/requests-2.26.0/requests/utils.py
--- old/requests-2.25.1/requests/utils.py 2020-12-16 18:43:25.000000000
+0100
+++ new/requests-2.26.0/requests/utils.py 2021-07-09 19:35:18.000000000
+0200
@@ -20,6 +20,7 @@
import warnings
import zipfile
from collections import OrderedDict
+from urllib3.util import make_headers
from .__version__ import __version__
from . import certs
@@ -41,6 +42,11 @@
DEFAULT_PORTS = {'http': 80, 'https': 443}
+# Ensure that ', ' is used to preserve previous delimiter behavior.
+DEFAULT_ACCEPT_ENCODING = ", ".join(
+ re.split(r",\s*", make_headers(accept_encoding=True)["accept-encoding"])
+)
+
if sys.platform == 'win32':
# provide a proxy_bypass version on Windows without DNS lookups
@@ -256,13 +262,28 @@
# we have a valid zip archive and a valid member of that archive
tmp = tempfile.gettempdir()
- extracted_path = os.path.join(tmp, *member.split('/'))
+ extracted_path = os.path.join(tmp, member.split('/')[-1])
if not os.path.exists(extracted_path):
- extracted_path = zip_file.extract(member, path=tmp)
-
+ # use read + write to avoid the creating nested folders, we only want
the file, avoids mkdir racing condition
+ with atomic_open(extracted_path) as file_handler:
+ file_handler.write(zip_file.read(member))
return extracted_path
[email protected]
+def atomic_open(filename):
+ """Write a file to the disk in an atomic fashion"""
+ replacer = os.rename if sys.version_info[0] == 2 else os.replace
+ tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename))
+ try:
+ with os.fdopen(tmp_descriptor, 'wb') as tmp_handler:
+ yield tmp_handler
+ replacer(tmp_name, filename)
+ except BaseException:
+ os.remove(tmp_name)
+ raise
+
+
def from_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
@@ -820,7 +841,7 @@
"""
return CaseInsensitiveDict({
'User-Agent': default_user_agent(),
- 'Accept-Encoding': ', '.join(('gzip', 'deflate')),
+ 'Accept-Encoding': DEFAULT_ACCEPT_ENCODING,
'Accept': '*/*',
'Connection': 'keep-alive',
})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests.egg-info/PKG-INFO
new/requests-2.26.0/requests.egg-info/PKG-INFO
--- old/requests-2.25.1/requests.egg-info/PKG-INFO 2020-12-16
20:37:50.000000000 +0100
+++ new/requests-2.26.0/requests.egg-info/PKG-INFO 2021-07-13
16:54:31.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: requests
-Version: 2.25.1
+Version: 2.26.0
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
@@ -10,7 +10,7 @@
Project-URL: Source, https://github.com/psf/requests
Description: # Requests
- **Requests** is a simple, yet elegant HTTP library.
+ **Requests** is a simple, yet elegant, HTTP library.
```python
>>> import requests
@@ -43,7 +43,7 @@
$ python -m pip install requests
```
- Requests officially supports Python 2.7 & 3.5+.
+ Requests officially supports Python 2.7 & 3.6+.
## Supported Features & Best???Practices
@@ -67,6 +67,22 @@
[](https://requests.readthedocs.io)
+ ## Cloning the repository
+
+ When cloning the Requests repository, you may need to add the `-c
+ fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad
commit (see
+ [this issue](https://github.com/psf/requests/issues/2690) for more
background):
+
+ ```shell
+ git clone -c fetch.fsck.badTimezone=ignore
https://github.com/psf/requests.git
+ ```
+
+ You can also apply this setting to your global Git config:
+
+ ```shell
+ git config --global fetch.fsck.badTimezone ignore
+ ```
+
---
[](https://kennethreitz.org)
[](https://www.python.org/psf)
@@ -80,14 +96,14 @@
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
Description-Content-Type: text/markdown
Provides-Extra: security
Provides-Extra: socks
+Provides-Extra: use_chardet_on_py3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requests.egg-info/requires.txt
new/requests-2.26.0/requests.egg-info/requires.txt
--- old/requests-2.25.1/requests.egg-info/requires.txt 2020-12-16
20:37:50.000000000 +0100
+++ new/requests-2.26.0/requests.egg-info/requires.txt 2021-07-13
16:54:31.000000000 +0200
@@ -1,14 +1,21 @@
-chardet<5,>=3.0.2
-idna<3,>=2.5
urllib3<1.27,>=1.21.1
certifi>=2017.4.17
+[:python_version < "3"]
+chardet<5,>=3.0.2
+idna<3,>=2.5
+
+[:python_version >= "3"]
+charset_normalizer~=2.0.0
+idna<4,>=2.5
+
[security]
-pyOpenSSL>=0.14
-cryptography>=1.3.4
[socks]
PySocks!=1.5.7,>=1.5.6
[socks:sys_platform == "win32" and python_version == "2.7"]
win_inet_pton
+
+[use_chardet_on_py3]
+chardet<5,>=3.0.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/requirements-dev.txt
new/requests-2.26.0/requirements-dev.txt
--- old/requests-2.25.1/requirements-dev.txt 2020-12-16 18:43:25.000000000
+0100
+++ new/requests-2.26.0/requirements-dev.txt 2021-07-13 16:52:57.000000000
+0200
@@ -1,6 +1,8 @@
pytest>=2.8.0,<=3.10.1
pytest-cov
-pytest-httpbin<1.0
+pytest-httpbin==1.0.0
pytest-mock==2.0.0
httpbin==0.7.0
+Flask>=1.0,<2.0
+trustme
wheel
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/setup.py new/requests-2.26.0/setup.py
--- old/requests-2.25.1/setup.py 2020-12-16 18:43:25.000000000 +0100
+++ new/requests-2.26.0/setup.py 2021-07-13 16:52:57.000000000 +0200
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# Learn more: https://github.com/kennethreitz/setup.py
import os
-import re
import sys
from codecs import open
@@ -42,8 +41,10 @@
packages = ['requests']
requires = [
- 'chardet>=3.0.2,<5',
- 'idna>=2.5,<3',
+ 'charset_normalizer~=2.0.0; python_version >= "3"',
+ 'chardet>=3.0.2,<5; python_version < "3"',
+ 'idna>=2.5,<3; python_version < "3"',
+ 'idna>=2.5,<4; python_version >= "3"',
'urllib3>=1.21.1,<1.27',
'certifi>=2017.4.17'
@@ -77,7 +78,7 @@
package_data={'': ['LICENSE', 'NOTICE']},
package_dir={'requests': 'requests'},
include_package_data=True,
- python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
+ python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*,
!=3.5.*",
install_requires=requires,
license=about['__license__'],
zip_safe=False,
@@ -90,7 +91,6 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
@@ -101,9 +101,10 @@
cmdclass={'test': PyTest},
tests_require=test_requirements,
extras_require={
- 'security': ['pyOpenSSL >= 0.14', 'cryptography>=1.3.4'],
+ 'security': [],
'socks': ['PySocks>=1.5.6, !=1.5.7'],
'socks:sys_platform == "win32" and python_version == "2.7"':
['win_inet_pton'],
+ 'use_chardet_on_py3': ['chardet>=3.0.2,<5']
},
project_urls={
'Documentation': 'https://requests.readthedocs.io',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/tests/conftest.py
new/requests-2.26.0/tests/conftest.py
--- old/requests-2.25.1/tests/conftest.py 2019-05-16 16:18:16.000000000
+0200
+++ new/requests-2.26.0/tests/conftest.py 2021-07-13 16:52:57.000000000
+0200
@@ -1,7 +1,19 @@
# -*- coding: utf-8 -*-
+try:
+ from http.server import HTTPServer
+ from http.server import SimpleHTTPRequestHandler
+except ImportError:
+ from BaseHTTPServer import HTTPServer
+ from SimpleHTTPServer import SimpleHTTPRequestHandler
+
+import ssl
+import tempfile
+import threading
+
import pytest
from requests.compat import urljoin
+import trustme
def prepare_url(value):
@@ -22,3 +34,25 @@
@pytest.fixture
def httpbin_secure(httpbin_secure):
return prepare_url(httpbin_secure)
+
+
[email protected]
+def nosan_server(tmp_path_factory):
+ tmpdir = tmp_path_factory.mktemp("certs")
+ ca = trustme.CA()
+ # only commonName, no subjectAltName
+ server_cert = ca.issue_cert(common_name=u"localhost")
+ ca_bundle = str(tmpdir / "ca.pem")
+ ca.cert_pem.write_to_path(ca_bundle)
+
+ context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
+ server_cert.configure_cert(context)
+ server = HTTPServer(("localhost", 0), SimpleHTTPRequestHandler)
+ server.socket = context.wrap_socket(server.socket, server_side=True)
+ server_thread = threading.Thread(target=server.serve_forever)
+ server_thread.start()
+
+ yield "localhost", server.server_address[1], ca_bundle
+
+ server.shutdown()
+ server_thread.join()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-2.25.1/tests/test_requests.py
new/requests-2.26.0/tests/test_requests.py
--- old/requests-2.25.1/tests/test_requests.py 2020-12-16 18:43:25.000000000
+0100
+++ new/requests-2.26.0/tests/test_requests.py 2021-07-13 16:52:57.000000000
+0200
@@ -24,7 +24,7 @@
from requests.exceptions import (
ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,
MissingSchema, ReadTimeout, Timeout, RetryError, TooManyRedirects,
- ProxyError, InvalidHeader, UnrewindableBodyError, SSLError,
InvalidProxyURL)
+ ProxyError, InvalidHeader, UnrewindableBodyError, SSLError,
InvalidProxyURL, InvalidJSONError)
from requests.models import PreparedRequest
from requests.structures import CaseInsensitiveDict
from requests.sessions import SessionRedirectMixin
@@ -40,6 +40,9 @@
# listening on that port)
TARPIT = 'http://10.255.255.1'
+# This is to avoid waiting the timeout of using TARPIT
+INVALID_PROXY='http://localhost:1'
+
try:
from ssl import SSLContext
del SSLContext
@@ -551,6 +554,42 @@
with pytest.raises(InvalidProxyURL):
requests.get(httpbin(), proxies={'http':
'http:///example.com:8080'})
+ def test_respect_proxy_env_on_send_self_prepared_request(self, httpbin):
+ with override_environ(http_proxy=INVALID_PROXY):
+ with pytest.raises(ProxyError):
+ session = requests.Session()
+ request = requests.Request('GET', httpbin())
+ session.send(request.prepare())
+
+ def test_respect_proxy_env_on_send_session_prepared_request(self, httpbin):
+ with override_environ(http_proxy=INVALID_PROXY):
+ with pytest.raises(ProxyError):
+ session = requests.Session()
+ request = requests.Request('GET', httpbin())
+ prepared = session.prepare_request(request)
+ session.send(prepared)
+
+ def test_respect_proxy_env_on_send_with_redirects(self, httpbin):
+ with override_environ(http_proxy=INVALID_PROXY):
+ with pytest.raises(ProxyError):
+ session = requests.Session()
+ url = httpbin('redirect/1')
+ print(url)
+ request = requests.Request('GET', url)
+ session.send(request.prepare())
+
+ def test_respect_proxy_env_on_get(self, httpbin):
+ with override_environ(http_proxy=INVALID_PROXY):
+ with pytest.raises(ProxyError):
+ session = requests.Session()
+ session.get(httpbin())
+
+ def test_respect_proxy_env_on_request(self, httpbin):
+ with override_environ(http_proxy=INVALID_PROXY):
+ with pytest.raises(ProxyError):
+ session = requests.Session()
+ session.request(method='GET', url=httpbin())
+
def test_basicauth_with_netrc(self, httpbin):
auth = ('user', 'pass')
wrong_auth = ('wronguser', 'wrongpass')
@@ -835,8 +874,9 @@
r = requests.get(httpbin(), cert='.')
assert r.status_code == 200
- def test_https_warnings(self, httpbin_secure, httpbin_ca_bundle):
+ def test_https_warnings(self, nosan_server):
"""warnings are emitted with requests.get"""
+ host, port, ca_bundle = nosan_server
if HAS_MODERN_SSL or HAS_PYOPENSSL:
warnings_expected = ('SubjectAltNameWarning', )
else:
@@ -846,8 +886,7 @@
with pytest.warns(None) as warning_records:
warnings.simplefilter('always')
- requests.get(httpbin_secure('status', '200'),
- verify=httpbin_ca_bundle)
+ requests.get("https://localhost:{}/".format(port),
verify=ca_bundle)
warning_records = [item for item in warning_records
if item.category.__name__ != 'ResourceWarning']
@@ -2527,3 +2566,8 @@
r = requests.Request('GET', url=input, params=params)
p = r.prepare()
assert p.url == expected
+
+ def test_post_json_nan(self, httpbin):
+ data = {"foo": float("nan")}
+ with pytest.raises(requests.exceptions.InvalidJSONError):
+ r = requests.post(httpbin('post'), json=data)
\ No newline at end of file