Skip to content
Open
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
2 changes: 1 addition & 1 deletion stubs/Authlib/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.6.11"
upstream-repository = "https://github.com/authlib/authlib"
dependencies = ["cryptography"]
dependencies = ["cryptography", "types-oauthlib", "requests"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Generator
from typing import NoReturn, TypeAlias
from typing import ClassVar, NoReturn, TypeAlias

from authlib.oauth2.auth import ClientAuth, TokenAuth
from authlib.oauth2.client import OAuth2Client as _OAuth2Client
Expand All @@ -24,10 +24,10 @@ class OAuth2ClientAuth(ClientAuth):

# Inherits from httpx.AsyncClient
class AsyncOAuth2Client(_OAuth2Client):
SESSION_REQUEST_PARAMS: list[str]
client_auth_class = OAuth2ClientAuth
token_auth_class = OAuth2Auth
oauth_error_class = OAuthError # type: ignore[assignment]
SESSION_REQUEST_PARAMS: ClassVar[list[str]]
client_auth_class: ClassVar[type[OAuth2ClientAuth]]
token_auth_class: ClassVar[type[OAuth2Auth]]
oauth_error_class: ClassVar[type[OAuthError]]
def __init__(
self,
client_id=None,
Expand All @@ -48,10 +48,10 @@ class AsyncOAuth2Client(_OAuth2Client):

# Inherits from httpx.Client
class OAuth2Client(_OAuth2Client):
SESSION_REQUEST_PARAMS: list[str]
client_auth_class = OAuth2ClientAuth
token_auth_class = OAuth2Auth
oauth_error_class = OAuthError # type: ignore[assignment]
SESSION_REQUEST_PARAMS: ClassVar[list[str]]
client_auth_class: ClassVar[type[OAuth2ClientAuth]]
token_auth_class: ClassVar[type[OAuth2Auth]]
oauth_error_class: ClassVar[type[OAuthError]]
def __init__(
self,
client_id=None,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any, ClassVar, TypeVar

from authlib.oauth2.auth import ClientAuth, TokenAuth
from authlib.oauth2.client import OAuth2Client
from oauthlib.oauth2 import OAuth2Token
from requests import PreparedRequest, Response, Session
from requests.auth import AuthBase

from ..base_client import OAuthError

__all__ = ["OAuth2Session", "OAuth2Auth"]

# Inherits from requests.auth.AuthBase
class OAuth2Auth(TokenAuth):
_PR = TypeVar("_PR", bound=PreparedRequest)

class OAuth2Auth(AuthBase, TokenAuth):
def ensure_active_token(self) -> None: ...
def __call__(self, req): ...
def __call__(self, req: _PR) -> _PR: ...

# Inherits from requests.auth.AuthBase
class OAuth2ClientAuth(ClientAuth):
def __call__(self, req): ...
class OAuth2ClientAuth(AuthBase, ClientAuth):
def __call__(self, req: _PR) -> _PR: ...

# Inherits from requests.Session
class OAuth2Session(OAuth2Client):
client_auth_class = OAuth2ClientAuth
token_auth_class = OAuth2Auth
oauth_error_class = OAuthError # type: ignore[assignment]
SESSION_REQUEST_PARAMS: tuple[str, ...] # type: ignore[assignment]
default_timeout: Incomplete
class OAuth2Session(OAuth2Client, Session):
client_auth_class: ClassVar[type[OAuth2ClientAuth]]
token_auth_class: ClassVar[type[OAuth2Auth]]
oauth_error_class: ClassVar[type[OAuthError]]
SESSION_REQUEST_PARAMS: ClassVar[tuple[str, ...]]
default_timeout: float | tuple[float | None, float | None] | None
def __init__(
self,
client_id=None,
client_secret=None,
token_endpoint_auth_method=None,
revocation_endpoint_auth_method=None,
scope=None,
state=None,
redirect_uri=None,
token=None,
token_placement="header",
update_token=None,
leeway=60,
default_timeout=None,
client_id: str | None = None,
client_secret: str | None = None,
token_endpoint_auth_method: str | None = None,
revocation_endpoint_auth_method: str | None = None,
scope: str | None = None,
state: str | None = None,
redirect_uri: str | None = None,
token: dict[str, Any] | None = None,
token_placement: str = ...,
update_token: Callable[[OAuth2Token], None] | None = None,
leeway: int = ...,
default_timeout: float | tuple[float | None, float | None] | None = None,
**kwargs,
) -> None: ...
def fetch_access_token(self, url=None, **kwargs): ...
def request(self, method, url, withhold_token=False, auth=None, **kwargs): ...
def fetch_access_token(self, url: str | None = None, **kwargs) -> OAuth2Token: ...
def request(self, method: str, url: str, withhold_token: bool = False, auth=None, **kwargs) -> Response: ... # type: ignore[override]
13 changes: 8 additions & 5 deletions stubs/Authlib/authlib/oauth2/client.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
from _typeshed import Incomplete
from collections.abc import Sequence
from typing import ClassVar

from authlib.oauth2 import ClientAuth, OAuth2Error, TokenAuth
from authlib.common.errors import AuthlibBaseError
from authlib.oauth2 import ClientAuth, TokenAuth

DEFAULT_HEADERS: Incomplete

class OAuth2Client:
client_auth_class = ClientAuth
token_auth_class = TokenAuth
oauth_error_class = OAuth2Error
client_auth_class: ClassVar[type[ClientAuth]]
token_auth_class: ClassVar[type[TokenAuth]]
oauth_error_class: ClassVar[type[AuthlibBaseError]]
EXTRA_AUTHORIZE_PARAMS: tuple[str, ...]
SESSION_REQUEST_PARAMS: list[str]
SESSION_REQUEST_PARAMS: ClassVar[Sequence[str]]
session: Incomplete
client_id: Incomplete
client_secret: Incomplete
Expand Down
Loading