From 0a19af54469b112995704faf041369eecfbee935 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 20:52:39 +0000 Subject: [PATCH 1/4] chore(deps): update httpx requirement in /packages/http/httpx Updates the requirements on [httpx](https://github.com/encode/httpx) to permit the latest version. - [Release notes](https://github.com/encode/httpx/releases) - [Changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md) - [Commits](https://github.com/encode/httpx/compare/0.23.0...0.28.0) --- updated-dependencies: - dependency-name: httpx dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- packages/http/httpx/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/http/httpx/pyproject.toml b/packages/http/httpx/pyproject.toml index 6680f9d..7f66f1c 100644 --- a/packages/http/httpx/pyproject.toml +++ b/packages/http/httpx/pyproject.toml @@ -29,7 +29,7 @@ python = ">=3.8,<4.0" microsoft-kiota-abstractions = {path="../../abstractions/", develop=true} opentelemetry-api = ">=1.27.0" opentelemetry-sdk = ">=1.27.0" -httpx = {extras = ["http2"], version = ">=0.23,<0.28"} +httpx = {extras = ["http2"], version = ">=0.23,<0.29"} urllib3 = "^2.2.2" [tool.poetry.group.dev.dependencies] From aa0b014db630af17ba2a99a63281b3a83454633d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 Dec 2024 12:56:24 -0500 Subject: [PATCH 2/4] chore: updates failed tests because of spacing --- packages/http/httpx/tests/test_httpx_request_adapter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/http/httpx/tests/test_httpx_request_adapter.py b/packages/http/httpx/tests/test_httpx_request_adapter.py index 0e5e0f5..89fdbe8 100644 --- a/packages/http/httpx/tests/test_httpx_request_adapter.py +++ b/packages/http/httpx/tests/test_httpx_request_adapter.py @@ -91,7 +91,7 @@ def test_enable_backing_store(request_adapter): @pytest.mark.asyncio async def test_get_root_parse_node(request_adapter, simple_success_response): - assert simple_success_response.text == '{"message": "Success!"}' + assert simple_success_response.text == '{"message":"Success!"}' assert simple_success_response.status_code == 200 content_type = request_adapter.get_response_content_type(simple_success_response) assert content_type == "application/json" @@ -118,7 +118,7 @@ async def test_get_root_parse_node_no_content_type_header_return_null( @pytest.mark.asyncio async def test_does_not_throw_failed_responses_on_success(request_adapter, simple_success_response): try: - assert simple_success_response.text == '{"message": "Success!"}' + assert simple_success_response.text == '{"message":"Success!"}' assert simple_success_response.status_code == 200 content_type = request_adapter.get_response_content_type(simple_success_response) assert content_type == "application/json" @@ -130,7 +130,7 @@ async def test_does_not_throw_failed_responses_on_success(request_adapter, simpl async def test_throw_failed_responses_null_error_map( request_adapter, simple_error_response, mock_otel_span ): - assert simple_error_response.text == '{"error": "not found"}' + assert simple_error_response.text == '{"error":"not found"}' assert simple_error_response.status_code == 404 content_type = request_adapter.get_response_content_type(simple_error_response) assert content_type == "application/json" @@ -149,7 +149,7 @@ async def test_throw_failed_responses_null_error_map( async def test_throw_failed_responses_no_error_class( request_adapter, simple_error_response, mock_error_500_map, mock_otel_span ): - assert simple_error_response.text == '{"error": "not found"}' + assert simple_error_response.text == '{"error":"not found"}' assert simple_error_response.status_code == 404 content_type = request_adapter.get_response_content_type(simple_error_response) assert content_type == "application/json" From 608e30495a938fcff3aaf633e3337b531b4f0df9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 Dec 2024 13:00:35 -0500 Subject: [PATCH 3/4] chore: updates proxies tests to use new interface Signed-off-by: Vincent Biret --- .../http/httpx/tests/test_kiota_client_factory.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/http/httpx/tests/test_kiota_client_factory.py b/packages/http/httpx/tests/test_kiota_client_factory.py index eec62d7..62273fb 100644 --- a/packages/http/httpx/tests/test_kiota_client_factory.py +++ b/packages/http/httpx/tests/test_kiota_client_factory.py @@ -34,11 +34,11 @@ def test_create_with_default_middleware_custom_client_with_proxy(): """Test creation of HTTP Client using default middleware while providing a custom client""" proxies = { - "http://": "http://localhost:8030", - "https://": "http://localhost:8031", + "http://": httpx.HTTPTransport(proxy="http://localhost:8030"), + "https://": httpx.HTTPTransport(proxy="http://localhost:8031"), } timeout = httpx.Timeout(20, connect=10) - custom_client = httpx.AsyncClient(timeout=timeout, http2=True, proxies=proxies) + custom_client = httpx.AsyncClient(timeout=timeout, http2=True, mounts=proxies) client = KiotaClientFactory.create_with_default_middleware(custom_client) assert isinstance(client, httpx.AsyncClient) @@ -96,11 +96,11 @@ def test_create_with_custom_middleware_custom_client_with_proxy(): """Test creation of HTTP Client using custom middleware while providing a custom client""" proxies = { - "http://": "http://localhost:8030", - "https://": "http://localhost:8031", + "http://": httpx.HTTPTransport(proxy="http://localhost:8030"), + "https://": httpx.HTTPTransport(proxy="http://localhost:8031"), } timeout = httpx.Timeout(20, connect=10) - custom_client = httpx.AsyncClient(timeout=timeout, http2=True, proxies=proxies) + custom_client = httpx.AsyncClient(timeout=timeout, http2=True, mounts=proxies) middleware = [ RetryHandler(), ] From bfb5bb7852af23d84a10e2708e27e24c42f4a3e0 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 Dec 2024 13:01:38 -0500 Subject: [PATCH 4/4] fix: bumps httpx minimum version to avoid confusion with API breaking changes --- packages/http/httpx/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/http/httpx/pyproject.toml b/packages/http/httpx/pyproject.toml index 7f66f1c..b9b0595 100644 --- a/packages/http/httpx/pyproject.toml +++ b/packages/http/httpx/pyproject.toml @@ -29,7 +29,7 @@ python = ">=3.8,<4.0" microsoft-kiota-abstractions = {path="../../abstractions/", develop=true} opentelemetry-api = ">=1.27.0" opentelemetry-sdk = ">=1.27.0" -httpx = {extras = ["http2"], version = ">=0.23,<0.29"} +httpx = {extras = ["http2"], version = ">=0.28"} urllib3 = "^2.2.2" [tool.poetry.group.dev.dependencies]