From 7e7a038be204fd246c0dba606625fe6deb36a0fb1bb9448224697b0e7629939c Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 20 May 2024 01:37:27 +0000 Subject: [PATCH 1/2] Accepting request 1174871 from home:mcalabkova:branches:devel:languages:python:pytest - update to 8.13.0 * Support the HTTPX client with asyncio * Added optional orjson serializer support OBS-URL: https://build.opensuse.org/request/show/1174871 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-elastic-transport?expand=0&rev=18 --- elastic-transport-python-8.12.0.tar.gz | 3 --- elastic-transport-python-8.13.0.tar.gz | 3 +++ python-elastic-transport.changes | 7 +++++++ python-elastic-transport.spec | 12 +++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) delete mode 100644 elastic-transport-python-8.12.0.tar.gz create mode 100644 elastic-transport-python-8.13.0.tar.gz diff --git a/elastic-transport-python-8.12.0.tar.gz b/elastic-transport-python-8.12.0.tar.gz deleted file mode 100644 index a06df46..0000000 --- a/elastic-transport-python-8.12.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:604bd1cc5f7161596dac3ca0ace70c2510c8bd21ca3f631b8ac422316deb3bfa -size 72207 diff --git a/elastic-transport-python-8.13.0.tar.gz b/elastic-transport-python-8.13.0.tar.gz new file mode 100644 index 0000000..2a6e1b9 --- /dev/null +++ b/elastic-transport-python-8.13.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56f52c45254bb73f64336a4b59e097702517f0603036559ac56b5a92782e0fda +size 75950 diff --git a/python-elastic-transport.changes b/python-elastic-transport.changes index dd58b0a..4a32fd6 100644 --- a/python-elastic-transport.changes +++ b/python-elastic-transport.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri May 17 13:29:03 UTC 2024 - Markéta Machová + +- update to 8.13.0 + * Support the HTTPX client with asyncio + * Added optional orjson serializer support + ------------------------------------------------------------------- Sat Jan 20 14:03:15 UTC 2024 - Dirk Müller diff --git a/python-elastic-transport.spec b/python-elastic-transport.spec index 85a832b..e054619 100644 --- a/python-elastic-transport.spec +++ b/python-elastic-transport.spec @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-elastic-transport -Version: 8.12.0 +Version: 8.13.0 Release: 0 Summary: Transport classes and utilities shared among Python Elastic client libraries License: Apache-2.0 @@ -31,18 +31,19 @@ BuildRequires: python-rpm-macros Requires: python-certifi Requires: python-urllib3 BuildArch: noarch -%if 0%{python_version_nodots} < 37 -Requires: python-dataclasses -%endif # SECTION test requirements BuildRequires: %{python_module aiohttp} BuildRequires: %{python_module certifi} -BuildRequires: %{python_module dataclasses if %python-base < 3.7} +BuildRequires: %{python_module httpx} +BuildRequires: %{python_module opentelemetry-api} +BuildRequires: %{python_module opentelemetry-sdk} +BuildRequires: %{python_module orjson} BuildRequires: %{python_module pytest-asyncio} BuildRequires: %{python_module pytest-httpserver} BuildRequires: %{python_module pytest-mock} BuildRequires: %{python_module pytest} BuildRequires: %{python_module requests} +BuildRequires: %{python_module respx} BuildRequires: %{python_module trustme} BuildRequires: %{python_module urllib3} # /SECTION @@ -68,6 +69,7 @@ sed -i 's/from mock/from unittest.mock/' tests/node/test_http_*.py donttest="(test_http_aiohttp and not TestAiohttpHttpNode)" donttest="$donttest or test_tls_versions" donttest="$donttest or test_assert_fingerprint_in_cert_chain" +donttest="$donttest or (test_ssl_assert_fingerprint and httpx)" # gh#elastic/elastic-transport-python#96 donttest="$donttest or test_url_to_node_config[https://[::1]:0/-https://[::1]:0-]" %pytest -k "not ($donttest)" From 2dcbde1a2b0b9b85d71d6fd07e3fe6ae2a34afeb027feb0221b3b079c2d9bce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Thu, 23 May 2024 08:49:58 +0000 Subject: [PATCH 2/2] Accepting request 1176037 from home:mcalabkova:branches:devel:languages:python - Add requests232.patch to fix compatibility with new requests OBS-URL: https://build.opensuse.org/request/show/1176037 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-elastic-transport?expand=0&rev=19 --- python-elastic-transport.changes | 5 ++ python-elastic-transport.spec | 4 +- requests232.patch | 87 ++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 requests232.patch diff --git a/python-elastic-transport.changes b/python-elastic-transport.changes index 4a32fd6..d25006d 100644 --- a/python-elastic-transport.changes +++ b/python-elastic-transport.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu May 23 08:17:35 UTC 2024 - Markéta Machová + +- Add requests232.patch to fix compatibility with new requests + ------------------------------------------------------------------- Fri May 17 13:29:03 UTC 2024 - Markéta Machová diff --git a/python-elastic-transport.spec b/python-elastic-transport.spec index e054619..6c9b834 100644 --- a/python-elastic-transport.spec +++ b/python-elastic-transport.spec @@ -24,6 +24,8 @@ Summary: Transport classes and utilities shared among Python Elastic clie License: Apache-2.0 URL: https://github.com/elastic/elastic-transport-python Source: https://github.com/elastic/elastic-transport-python/archive/refs/tags/v%{version}.tar.gz#/elastic-transport-python-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/elastic/elastic-transport-python/pull/164 Fix requests 2.32 compatibility +Patch: requests232.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -53,7 +55,7 @@ BuildRequires: %{python_module urllib3} Transport classes and utilities shared among Python Elastic client libraries %prep -%setup -q -n elastic-transport-python-%{version} +%autosetup -p1 -n elastic-transport-python-%{version} sed -i '/addopts/d' setup.cfg sed -i 's/from mock/from unittest.mock/' tests/node/test_http_*.py diff --git a/requests232.patch b/requests232.patch new file mode 100644 index 0000000..bee36e2 --- /dev/null +++ b/requests232.patch @@ -0,0 +1,87 @@ +From d49d5dda344f0a458c020a8a3c0032480e6b57d5 Mon Sep 17 00:00:00 2001 +From: Quentin Pradet +Date: Thu, 23 May 2024 11:48:10 +0400 +Subject: [PATCH 1/3] Fix requests 2.32 compatibility + +--- + elastic_transport/_node/_http_requests.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/elastic_transport/_node/_http_requests.py b/elastic_transport/_node/_http_requests.py +index 19cec37..e439865 100644 +--- a/elastic_transport/_node/_http_requests.py ++++ b/elastic_transport/_node/_http_requests.py +@@ -169,7 +169,16 @@ def __init__(self, config: NodeConfig): + ) + # Preload the HTTPConnectionPool so initialization issues + # are raised here instead of in perform_request() +- adapter.get_connection(self.base_url) # type: ignore[no-untyped-call] ++ if hasattr(adapter, "get_connection_with_tls_context"): ++ adapter.get_connection_with_tls_context( ++ requests.Request(url=self.base_url), verify=self.session.verify ++ ) ++ else: ++ # elastic-transport is not vulnerable to CVE-2024-35195 because it uses ++ # requests.Session and an SSLContext without using the verify parameter. ++ # We should remove this branch when requiring requests 2.32 or later. ++ adapter.get_connection(self.base_url) # type: ignore [no-untyped-call] ++ + self.session.mount(prefix=f"{self.scheme}://", adapter=adapter) + + def perform_request( + +From 56d1e6832d0b438ee7cee3ab0f8dea6a14a89eb8 Mon Sep 17 00:00:00 2001 +From: Quentin Pradet +Date: Thu, 23 May 2024 11:59:42 +0400 +Subject: [PATCH 2/3] Fix lint + +--- + elastic_transport/_node/_http_requests.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/elastic_transport/_node/_http_requests.py b/elastic_transport/_node/_http_requests.py +index e439865..4b2d502 100644 +--- a/elastic_transport/_node/_http_requests.py ++++ b/elastic_transport/_node/_http_requests.py +@@ -170,14 +170,16 @@ def __init__(self, config: NodeConfig): + # Preload the HTTPConnectionPool so initialization issues + # are raised here instead of in perform_request() + if hasattr(adapter, "get_connection_with_tls_context"): ++ request = requests.Request(url=self.base_url) ++ prepared_request = self.session.prepare_request(request) + adapter.get_connection_with_tls_context( +- requests.Request(url=self.base_url), verify=self.session.verify ++ prepared_request, verify=self.session.verify + ) + else: + # elastic-transport is not vulnerable to CVE-2024-35195 because it uses + # requests.Session and an SSLContext without using the verify parameter. + # We should remove this branch when requiring requests 2.32 or later. +- adapter.get_connection(self.base_url) # type: ignore [no-untyped-call] ++ adapter.get_connection(self.base_url) + + self.session.mount(prefix=f"{self.scheme}://", adapter=adapter) + + +From 8a222e2c9b81dc9f7a1e4583de59ecc0d4c4d803 Mon Sep 17 00:00:00 2001 +From: Quentin Pradet +Date: Thu, 23 May 2024 12:02:53 +0400 +Subject: [PATCH 3/3] Fix prepared request + +--- + elastic_transport/_node/_http_requests.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/elastic_transport/_node/_http_requests.py b/elastic_transport/_node/_http_requests.py +index 4b2d502..941e3cc 100644 +--- a/elastic_transport/_node/_http_requests.py ++++ b/elastic_transport/_node/_http_requests.py +@@ -170,7 +170,7 @@ def __init__(self, config: NodeConfig): + # Preload the HTTPConnectionPool so initialization issues + # are raised here instead of in perform_request() + if hasattr(adapter, "get_connection_with_tls_context"): +- request = requests.Request(url=self.base_url) ++ request = requests.Request(method="GET", url=self.base_url) + prepared_request = self.session.prepare_request(request) + adapter.get_connection_with_tls_context( + prepared_request, verify=self.session.verify