Skip to content

auth

etrack.infra.auth

infra/auth: AuthSigner — one configured Auth turned into what goes on the wire, for any driver.

Static kinds sign at once: fixed headers, a bearer token, basic credentials. google resolves Application Default Credentials once, off the loop (ready), and refreshes the token off the loop whenever it is no longer valid; its headers carry Authorization and the quota project. A driver built on requests (the OTLP exporters) takes session() instead — google-auth's AuthorizedSession refreshes on its own and retries a 401 once refreshed.

AuthSigner

AuthSigner(
    auth: Auth, credentials: Credentials | None = None
)

Signs a driver's requests with one Auth; Google credentials may be handed in (tests, a custom chain).

headers async

headers() -> dict[str, str]

Every header for the next request, a Google token refreshed off the loop when it is no longer valid.

ready async

ready() -> Self

Resolve what signing needs before the first request: Google credentials, off the loop; nothing otherwise.

session

session() -> Session | None

For a driver built on requests: Google's refreshing session, or none — the static headers suffice.

static

static() -> dict[str, str]

The headers that never change: everything but a refreshing token.