11from _typeshed import Incomplete
2+ from http .cookiejar import CookieJar
23
34from authlib .oauth2 .auth import ClientAuth , TokenAuth
45from authlib .oauth2 .client import OAuth2Client
6+ from requests import PreparedRequest , Response , Session
7+ from requests ._types import (
8+ AuthType ,
9+ CertType ,
10+ DataType ,
11+ FilesType ,
12+ HeadersType ,
13+ HooksInputType ,
14+ JsonType ,
15+ ParamsType ,
16+ TimeoutType ,
17+ UriType ,
18+ VerifyType ,
19+ )
20+ from requests .auth import AuthBase
21+ from requests .cookies import RequestsCookieJar
522
623from ..base_client import OAuthError
724
825__all__ = ["OAuth2Session" , "OAuth2Auth" ]
926
10- # Inherits from requests.auth.AuthBase
11- class OAuth2Auth (TokenAuth ):
27+ class OAuth2Auth (AuthBase , TokenAuth ):
1228 def ensure_active_token (self ) -> None : ...
13- def __call__ (self , req ) : ...
29+ def __call__ (self , req : PreparedRequest ) -> PreparedRequest : ...
1430
15- # Inherits from requests.auth.AuthBase
16- class OAuth2ClientAuth (ClientAuth ):
17- def __call__ (self , req ): ...
31+ class OAuth2ClientAuth (AuthBase , ClientAuth ):
32+ def __call__ (self , req : PreparedRequest ) -> PreparedRequest : ...
1833
19- # Inherits from requests.Session
20- class OAuth2Session (OAuth2Client ):
34+ class OAuth2Session (OAuth2Client , Session ):
2135 client_auth_class = OAuth2ClientAuth
2236 token_auth_class = OAuth2Auth
2337 oauth_error_class = OAuthError # type: ignore[assignment]
@@ -40,4 +54,24 @@ class OAuth2Session(OAuth2Client):
4054 ** kwargs ,
4155 ) -> None : ...
4256 def fetch_access_token (self , url = None , ** kwargs ): ...
43- def request (self , method , url , withhold_token = False , auth = None , ** kwargs ): ...
57+ def request ( # type: ignore[override]
58+ self ,
59+ method : str ,
60+ url : UriType ,
61+ withhold_token : bool = False ,
62+ auth : AuthType = None ,
63+ * ,
64+ params : ParamsType = None ,
65+ data : DataType = None ,
66+ headers : HeadersType = None ,
67+ cookies : RequestsCookieJar | CookieJar | dict [str , str ] | None = None ,
68+ files : FilesType = None ,
69+ timeout : TimeoutType = None ,
70+ allow_redirects : bool = True ,
71+ proxies : dict [str , str ] | None = None ,
72+ hooks : HooksInputType | None = None ,
73+ stream : bool | None = None ,
74+ verify : VerifyType | None = None ,
75+ cert : CertType = None ,
76+ json : JsonType = None ,
77+ ) -> Response : ...
0 commit comments