Sync from SUSE:SLFO:Main python-requests-toolbelt revision 339dcdbb2eb30cee8a2027614c53ca03

This commit is contained in:
Adrian Schröter 2024-05-03 22:49:22 +02:00
commit 7bf1ca74f6
7 changed files with 1971 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,148 @@
-------------------------------------------------------------------
Thu May 4 18:10:01 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Upgrade to 1.0.0:
- Breaking Changes
- Removed Google App Engine support to allow using urllib3 2.0
- New Features
- Add support for preparing requests in BaseUrlSession
- Fixed Bugs
- Ensured the test suite no longer reaches the Internet
- Fix urllib3 warning to only emit on X509Adapter usage
- Fixing missing newline in dump utility
- Miscellaneous
- Added explicit support for Python 3.11
- Remove upstreamed patches:
- fix-tests.patch
- remove_mock.patch
- requests-toolbelt-pr246-collections.abc.patch
- Add 356-add-missing-casette-files.patch which adds missing
casette test files (gh#requests/toolbelt!356).
-------------------------------------------------------------------
Fri Apr 21 12:33:06 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:44:31 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Fri Sep 30 04:24:08 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch stop-using-pyopenssl-compat.patch:
* Stop importing (and using!) a pyopenssl compatibility module
to avoid a DeprecationWarning.
-------------------------------------------------------------------
Wed Mar 2 02:03:40 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Properly redo the regeneration of test_certs.p12.
-------------------------------------------------------------------
Sat Dec 11 21:24:19 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Fix python310 failure due to moved collections.abc
* add requests-toolbelt-pr246-collections.abc.patch
* gh#requests/toolbelt#246
-------------------------------------------------------------------
Mon Nov 29 04:35:08 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Regenerate test_certs.p12 due to the upstream certificate expiring
-------------------------------------------------------------------
Thu Feb 11 16:08:10 UTC 2021 - Pedro Monreal <pmonreal@suse.com>
- Relax the crypto policies for the test-suite
-------------------------------------------------------------------
Mon Dec 14 00:35:01 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- Fix condition around BuildRequirement
-------------------------------------------------------------------
Sun Dec 13 21:51:50 UTC 2020 - Matej Cepl <mcepl@suse.com>
- We don't need to break Python 2.7
-------------------------------------------------------------------
Mon Dec 7 08:09:35 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Add remove_mock.patch to remove dependency on the external mock
-------------------------------------------------------------------
Mon May 6 14:06:37 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to fix tests fix-tests.patch
- Use pytest to execute the tests, same as the upstream
-------------------------------------------------------------------
Thu Apr 25 19:57:47 UTC 2019 - Dirk Mueller <dmueller@suse.com>
- update to 0.9.1:
- Fix import of pyOpenSSL shim from urllib3 for PKCS12 adapter
- Add X509 Adapter that can handle PKCS12
- Add stateless solution for streaming files by MultipartEncoder from one host to another (in chunks)
- Update link to example
- Move import of ``ABCs`` from collections into version-specific part of
_compat module
- Fix backwards incompatibility in ``get_encodings_from_content``
- Correct callback documentation for ``MultipartEncoderMonitor``
- Fix bug when ``MultipartEncoder`` is asked to encode zero parts
- Correct the type of non string request body dumps
- Removed content from being stored in MultipartDecoder
- Fix bug by enabling support for contenttype with capital letters.
- Coerce proxy URL to bytes before dumping request
- Avoid bailing out with exception upon empty response reason
- Corrected Pool documentation
- Corrected parentheses match in example usage
- Fix "oject" to "object" in ``MultipartEncoder``
- Fix URL for the project after the move
- Add fix for OSX TCPKeepAliveAdapter
-------------------------------------------------------------------
Fri Jun 30 16:59:55 UTC 2017 - aloisio@gmx.com
- Update to version 0.8.0 (see HISTORY.rst)
- Converted to single-spec
-------------------------------------------------------------------
Tue May 16 16:04:50 UTC 2017 - dmueller@suse.com
- convert to singlespec
-------------------------------------------------------------------
Thu Jan 19 10:10:48 UTC 2017 - dmueller@suse.com
- use pypi.io source link
-------------------------------------------------------------------
Wed Jan 18 11:51:40 UTC 2017 - michael@stroeder.com
- update to upstream release 0.7.0
- simply rely on python_sitelib macro when installing files
-------------------------------------------------------------------
Mon Jul 13 13:12:38 UTC 2015 - toddrme2178@gmail.com
- Fix building on SLES 11
-------------------------------------------------------------------
Mon Nov 17 15:58:27 UTC 2014 - seiler@b1-systems.de
- added explicit version dependency for python-request to avoid build errors
for old distributions
-------------------------------------------------------------------
Thu Nov 13 17:06:47 UTC 2014 - seiler@b1-systems.de
- added python-requests to build requirements to do python tests
-------------------------------------------------------------------
Wed Nov 5 09:36:57 UTC 2014 - seiler@b1-systems.de
- inital commit

View File

@ -0,0 +1,87 @@
#
# spec file for package python-requests-toolbelt
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-requests-toolbelt
Version: 1.0.0
Release: 0
Summary: A utility belt for advanced users of python3-requests
License: Apache-2.0
URL: https://github.com/requests/toolbelt
Source: https://files.pythonhosted.org/packages/source/r/requests-toolbelt/requests-toolbelt-%{version}.tar.gz
# Replace expired test certificate
Source1: test_cert.p12
# PATCH-FIX-OPENSUSE Stop using PyOpenSSLCompat, it generates widespread
# DeprecationWarnings
Patch0: stop-using-pyopenssl-compat.patch
# PATCH-FIX-UPSTREAM 356-add-missing-casette-files.patch gh#requests/toolbelt!356 mcepl@suse.com
# add missing casette files
Patch1: 356-add-missing-casette-files.patch
BuildRequires: %{python_module requests >= 2.12.2}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-requests >= 2.12.2
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module betamax >= 0.5.0}
# gh#pyca/cryptography#5606
BuildRequires: %{python_module pyOpenSSL >= 19.1.0}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module trustme}
%if 0%{?suse_version} <= 1500
BuildRequires: python-mock
%endif
# /SECTION
%python_subpackages
%description
This is just a collection of utilities for `python-requests`_, but don't
really belong in ``requests`` proper. The minimum tested requests version is
``2.1.0``. In reality, the toolbelt should work with ``2.0.1`` as well, but
some idiosyncracies prevent effective or sane testing on that version.
%prep
%autosetup -p1 -n requests-toolbelt-%{version}
cp %{SOURCE1} tests/certs
rm -rf requests_toolbelt.egg-info
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# Relax the crypto policies for the test-suite
export OPENSSL_SYSTEM_CIPHERS_OVERRIDE=xyz_nonexistent_file
export OPENSSL_CONF=''
# Requires network access
%pytest
# -k 'not network'
%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitelib}/requests_toolbelt
%{python_sitelib}/requests_toolbelt-%{version}*-info
%changelog

BIN
requests-toolbelt-1.0.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,66 @@
---
requests_toolbelt/adapters/x509.py | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
--- a/requests_toolbelt/adapters/x509.py
+++ b/requests_toolbelt/adapters/x509.py
@@ -8,6 +8,7 @@ X.509 certificate without needing to con
"""
from OpenSSL.crypto import PKey, X509
+from OpenSSL.SSL import Context, TLS_CLIENT_METHOD
from cryptography import x509
from cryptography.hazmat.primitives.serialization import (load_pem_private_key,
load_der_private_key)
@@ -20,16 +21,6 @@ import requests
from .. import exceptions as exc
-"""
-importing the protocol constants from _ssl instead of ssl because only the
-constants are needed and to handle issues caused by importing from ssl on
-the 2.7.x line.
-"""
-try:
- from _ssl import PROTOCOL_TLS as PROTOCOL
-except ImportError:
- from _ssl import PROTOCOL_SSLv23 as PROTOCOL
-
PyOpenSSLContext = None
@@ -84,7 +75,6 @@ class X509Adapter(HTTPAdapter):
def __init__(self, *args, **kwargs):
self._import_pyopensslcontext()
- self._check_version()
cert_bytes = kwargs.pop('cert_bytes', None)
pk_bytes = kwargs.pop('pk_bytes', None)
password = kwargs.pop('password', None)
@@ -136,15 +126,6 @@ class X509Adapter(HTTPAdapter):
except ImportError:
PyOpenSSLContext = None
- def _check_version(self):
- if PyOpenSSLContext is None:
- raise exc.VersionMismatchError(
- "The X509Adapter requires at least Requests 2.12.0 to be "
- "installed. Version {} was found instead.".format(
- requests.__version__
- )
- )
-
def check_cert_dates(cert):
"""Verify that the supplied client cert is not invalid."""
@@ -190,7 +171,7 @@ def create_ssl_context(cert_byes, pk_byt
raise ValueError('Cert and key could not be parsed from '
'provided data')
check_cert_dates(cert)
- ssl_context = PyOpenSSLContext(PROTOCOL)
- ssl_context._ctx.use_certificate(X509.from_cryptography(cert))
- ssl_context._ctx.use_privatekey(PKey.from_cryptography_key(key))
+ ssl_context = Context(TLS_CLIENT_METHOD)
+ ssl_context.use_certificate(X509.from_cryptography(cert))
+ ssl_context.use_privatekey(PKey.from_cryptography_key(key))
return ssl_context

BIN
test_cert.p12 Normal file

Binary file not shown.