class documentation

Bearer that exposes a PureFileCacheReceiver for a named token.

Notes

Construction is inexpensive; the cache performs I/O lazily when tokens are accessed via the receiver.

Example

Create a bearer that reads credentials from the default credentials file and caches them for five minutes:

from nebius.aio.token.file_cache.file_bearer import PureFileCacheBearer
from nebius.sdk import SDK

bearer = PureFileCacheBearer('my-service')
sdk = SDK(credentials=bearer)
Parameters
nameLogical name for the credential.
cache_fileDestination YAML file used to persist tokens.
throttleThrottle interval for in-memory caching.
Method __init__ Create a bearer backed by a throttled file cache.
Method receiver Return a PureFileCacheReceiver bound to the cache.
Property name Return the logical name for this bearer.
Instance Variable _cache Undocumented
Instance Variable _name Undocumented

Inherited from Bearer:

Async Method close Close the bearer and any wrapped resources.
Property wrapped Return the wrapped bearer or None if not wrapping.
def __init__(self, name: str, cache_file: str | Path = Path(DEFAULT_CONFIG_DIR) / DEFAULT_CREDENTIALS_FILE, throttle: timedelta | float = timedelta(minutes=5)): (source)

Create a bearer backed by a throttled file cache.

def receiver(self) -> ParentReceiver: (source)

Return a PureFileCacheReceiver bound to the cache.

Each call returns a fresh receiver that references the same ThrottledTokenCache instance.

Returns
ParentReceiverA receiver that reads from the shared cache.

Return the logical name for this bearer.

Returns
The name provided at construction.

Undocumented

Undocumented