module documentation
File-backed static token bearer.
This module provides a tiny bearer implementation that reads a raw access token from a filesystem path. It is useful for local testing, scripting or environments where a short-lived token is written to a file by an external process or host system.
Fetched tokens are cached for a short refresh period to avoid reading
the file for every request. If a request fails with an authentication
error, Receiver.can_retry checks whether the file now contains a
different token and invalidates the cache so the retry re-reads the file.
Empty file contents raise an nebius.base.error.SDKError.
Examples
Create a bearer that reads from ~/.nebius/token:
from nebius.aio.token.file import Bearer
bearer = Bearer("~/.nebius/token")
token = await bearer.receiver().fetch()
Use in code that expects a nebius.aio.token.token.Bearer:
sdk = SDK(credentials=bearer)