Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from __future__ import annotations

from authlib.integrations.httpx_client import AsyncOAuth2Client


# ================================================================================
# Test for AsyncOAuth2Client contex manager being correctly inherited and present.
# ================================================================================
async def test_client_contex_manager() -> None:
async with AsyncOAuth2Client():
pass
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Generator
from contextlib import _AsyncGeneratorContextManager
from typing import ClassVar
from typing_extensions import Never
from typing_extensions import Never, Self

import httpx2
from authlib.oauth2.auth import ClientAuth, TokenAuth
Expand Down Expand Up @@ -42,8 +43,11 @@ class AsyncOAuth2Client(_OAuth2Client, httpx2.AsyncClient):
leeway=60,
**kwargs,
) -> None: ...
async def __aenter__(self) -> Self: ...
async def request(self, method, url, withhold_token: bool = False, auth=..., **kwargs): ...
async def stream(self, method, url, withhold_token: bool = False, auth=..., **kwargs) -> Generator[Response]: ... # type: ignore[override]
def stream(
self, method, url, withhold_token: bool = False, auth=..., **kwargs
) -> _AsyncGeneratorContextManager[Response]: ...
async def ensure_active_token(self, token): ... # type: ignore[override]

class OAuth2Client(_OAuth2Client, httpx2.Client):
Expand Down
Loading