RenewingTokenAuth
Bearer token auth flow renewing its token through a source on HTTP 401.
Bearer token auth flow renewing its token through a source on HTTP 401.
Functions
constructor__init__(source) -> NoneInitialize the auth flow.
paramsourceTokenSourceSource producing and renewing the bearer token.
Returns
Nonefuncasync_auth_flow(request) -> AsyncGenerator[httpx.Request, httpx.Response]Attach a bearer token and retry once with a renewed one on HTTP 401.
A request rejected with HTTP 401 is retried once with a renewed token, unless another caller renewed it first, in which case the retry uses theirs.
paramrequesthttpx.RequestOutgoing HTTP request.
Returns
collections.abc.AsyncGenerator[httpx.httpx.Request, httpx.httpx.Response]funcclose() -> NoneClose the token source.
Returns
None