class documentation

A receiver that reads a token from a filesystem path.

Each call to _fetch opens and reads the configured file, so the token may change between fetches if the file is updated by an external process.

Parameters
filepathlib.Path pointing to a file containing a raw access token (UTF-8 text). The file is read on each fetch and must contain a non-empty token string.
Method __init__ Create a file-backed receiver.
Method can_retry Indicate that file-backed tokens are not retryable.
Async Method _fetch Read the token file and return a Token.
Instance Variable _file Undocumented

Inherited from Receiver:

Async Method fetch Fetch a token and record it as the latest value.
Property latest Return the latest fetched token or None.
Instance Variable _latest The most recently fetched token, or None if no token has been fetched yet. Implementations may update this to support inspection or caching by callers.
def __init__(self, file: Path): (source)

Create a file-backed receiver.

def can_retry(self, err: Exception, options: dict[str, str] | None = None) -> bool: (source)

Indicate that file-backed tokens are not retryable.

The token is static from the perspective of this receiver; retries are not useful because there is no remote call to repeat.

async def _fetch(self, timeout: float | None = None, options: dict[str, str] | None = None) -> Token: (source)

Read the token file and return a Token.

Parameters
timeout:float | NoneIgnored for file-backed receivers but accepted for API compatibility.
options:dict[str, str] | NoneIgnored; present for API compatibility.
Returns
TokenA Token constructed from the file contents.
Raises
SDKErrorIf the file contains an empty string.
OSErrorIf the file cannot be opened.

Undocumented