15
0

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
This commit is contained in:
2024-12-19 15:37:31 +00:00
committed by Git OBS Bridge
parent a61a7fb097
commit 0ee18569d9
3 changed files with 113 additions and 0 deletions

106
httpx028.patch Normal file
View File

@@ -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__(

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Dec 19 13:57:51 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add httpx028.patch to add compatibility with new httpx
-------------------------------------------------------------------
Thu Oct 31 09:13:27 UTC 2024 - Dirk Müller <dmueller@suse.com>

View File

@@ -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}