module documentation
Asynchronous bearer token abstractions and the token representation.
This module provides the core abstractions used by the SDK for representing bearer tokens and for supplying per-request token receivers.
Key classes
Token-- simple immutable representation of an access token and an- optional expiration time.
Examples
Create a simple token and serialize it:
from nebius.aio.token.token import Token
from datetime import datetime, timezone, timedelta
tok = Token(
"s3cr3t",
expiration=datetime.now(timezone.utc) + timedelta(hours=1),
)
print(str(tok))
data = tok.to_dict()
Restore the token from the serialized form:
tok2 = Token.from_dict(data) assert tok == tok2
Using a static bearer/receiver (see nebius.aio.token.static for
concrete implementations) the SDK creates per-request receivers with
bearer.receiver() and uses Receiver.fetch to obtain tokens.
| Class | |
Abstract provider of Receiver instances. |
| Class | |
Simple bearer wrapper that attaches a static name to another bearer. |
| Class | |
Abstract asynchronous token receiver interface. |
| Class | |
Representation of a bearer token with optional expiration. |
| Variable | sanitizer |
Undocumented |