From 0ee18569d9c5771c274e2cf70e704ad7797e0bd0cf443d0eec3793287d10ae6c Mon Sep 17 00:00:00 2001 From: Nico Krapp Date: Thu, 19 Dec 2024 15:37:31 +0000 Subject: [PATCH] Accepting request 1232567 from home:mcalabkova:branches:devel:languages:python - Add httpx028.patch to add compatibility with new httpx OBS-URL: https://build.opensuse.org/request/show/1232567 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Authlib?expand=0&rev=34 --- httpx028.patch | 106 +++++++++++++++++++++++++++++++++++++++++ python-Authlib.changes | 5 ++ python-Authlib.spec | 2 + 3 files changed, 113 insertions(+) create mode 100644 httpx028.patch diff --git a/httpx028.patch b/httpx028.patch new file mode 100644 index 0000000..ead59d3 --- /dev/null +++ b/httpx028.patch @@ -0,0 +1,106 @@ +Index: authlib-1.3.2/authlib/integrations/httpx_client/oauth2_client.py +=================================================================== +--- authlib-1.3.2.orig/authlib/integrations/httpx_client/oauth2_client.py ++++ authlib-1.3.2/authlib/integrations/httpx_client/oauth2_client.py +@@ -62,6 +62,11 @@ class AsyncOAuth2Client(_OAuth2Client, h + + # extract httpx.Client kwargs + client_kwargs = self._extract_session_request_params(kwargs) ++ # app keyword was dropped! ++ app_value = client_kwargs.pop('app', None) ++ if app_value is not None: ++ client_kwargs['transport'] = httpx.ASGITransport(app=app_value) ++ + httpx.AsyncClient.__init__(self, **client_kwargs) + + # We use a Lock to synchronize coroutines to prevent +@@ -177,6 +182,11 @@ class OAuth2Client(_OAuth2Client, httpx. + + # extract httpx.Client kwargs + client_kwargs = self._extract_session_request_params(kwargs) ++ # app keyword was dropped! ++ app_value = client_kwargs.pop('app', None) ++ if app_value is not None: ++ client_kwargs['transport'] = httpx.WSGITransport(app=app_value) ++ + httpx.Client.__init__(self, **client_kwargs) + + _OAuth2Client.__init__( +Index: authlib-1.3.2/tests/clients/test_httpx/test_async_oauth2_client.py +=================================================================== +--- authlib-1.3.2.orig/tests/clients/test_httpx/test_async_oauth2_client.py ++++ authlib-1.3.2/tests/clients/test_httpx/test_async_oauth2_client.py +@@ -4,7 +4,7 @@ import pytest + from unittest import mock + from copy import deepcopy + +-from httpx import AsyncClient ++from httpx import AsyncClient, ASGITransport + + from authlib.common.security import generate_token + from authlib.common.urls import url_encode +@@ -96,7 +96,7 @@ async def test_add_token_to_streaming_re + token_placement="header", + app=AsyncMockDispatch({'a': 'a'}, assert_func=assert_token_in_header) + ), +- AsyncClient(app=AsyncMockDispatch({'a': 'a'})) ++ AsyncClient(transport=ASGITransport(app=AsyncMockDispatch({'a': 'a'}))) + ]) + async def test_httpx_client_stream_match(client): + async with client as client_entered: +Index: authlib-1.3.2/authlib/integrations/httpx_client/oauth1_client.py +=================================================================== +--- authlib-1.3.2.orig/authlib/integrations/httpx_client/oauth1_client.py ++++ authlib-1.3.2/authlib/integrations/httpx_client/oauth1_client.py +@@ -34,6 +34,11 @@ class AsyncOAuth1Client(_OAuth1Client, h + force_include_body=False, **kwargs): + + _client_kwargs = extract_client_kwargs(kwargs) ++ # app keyword was dropped! ++ app_value = _client_kwargs.pop('app', None) ++ if app_value is not None: ++ _client_kwargs['transport'] = httpx.ASGITransport(app=app_value) ++ + httpx.AsyncClient.__init__(self, **_client_kwargs) + + _OAuth1Client.__init__( +@@ -87,6 +92,11 @@ class OAuth1Client(_OAuth1Client, httpx. + force_include_body=False, **kwargs): + + _client_kwargs = extract_client_kwargs(kwargs) ++ # app keyword was dropped! ++ app_value = _client_kwargs.pop('app', None) ++ if app_value is not None: ++ _client_kwargs['transport'] = httpx.WSGITransport(app=app_value) ++ + httpx.Client.__init__(self, **_client_kwargs) + + _OAuth1Client.__init__( +Index: authlib-1.3.2/authlib/integrations/httpx_client/assertion_client.py +=================================================================== +--- authlib-1.3.2.orig/authlib/integrations/httpx_client/assertion_client.py ++++ authlib-1.3.2/authlib/integrations/httpx_client/assertion_client.py +@@ -22,6 +22,11 @@ class AsyncAssertionClient(_AssertionCli + claims=None, token_placement='header', scope=None, **kwargs): + + client_kwargs = extract_client_kwargs(kwargs) ++ # app keyword was dropped! ++ app_value = client_kwargs.pop('app', None) ++ if app_value is not None: ++ client_kwargs['transport'] = httpx.ASGITransport(app=app_value) ++ + httpx.AsyncClient.__init__(self, **client_kwargs) + + _AssertionClient.__init__( +@@ -61,6 +66,11 @@ class AssertionClient(_AssertionClient, + claims=None, token_placement='header', scope=None, **kwargs): + + client_kwargs = extract_client_kwargs(kwargs) ++ # app keyword was dropped! ++ app_value = client_kwargs.pop('app', None) ++ if app_value is not None: ++ client_kwargs['transport'] = httpx.WSGITransport(app=app_value) ++ + httpx.Client.__init__(self, **client_kwargs) + + _AssertionClient.__init__( diff --git a/python-Authlib.changes b/python-Authlib.changes index 7300887..38166ea 100644 --- a/python-Authlib.changes +++ b/python-Authlib.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Dec 19 13:57:51 UTC 2024 - Markéta Machová + +- Add httpx028.patch to add compatibility with new httpx + ------------------------------------------------------------------- Thu Oct 31 09:13:27 UTC 2024 - Dirk Müller diff --git a/python-Authlib.spec b/python-Authlib.spec index 4547189..c58a2b8 100644 --- a/python-Authlib.spec +++ b/python-Authlib.spec @@ -26,6 +26,8 @@ License: BSD-3-Clause URL: https://authlib.org/ Source: https://github.com/lepture/%{modname}/archive/refs/tags/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz Patch1: https://github.com/lepture/authlib/commit/d282c1afad676cf8ed3670e60fd43516fc9615de.patch#/py313-tests.patch +# PATCH-FIX-UPSTREAM https://github.com/lepture/authlib/pull/695 Support httpx 0.28 +Patch2: httpx028.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel}