class documentation

Receiver that requests asynchronous renewals when needed.

The receiver delegates to the parent AsynchronousRenewableFileCacheBearer for actual fetching and renewal coordination. It tracks a small retry counter so transient errors can be retried a configurable number of times.

Example

Constructing a receiver is normally done via the bearer's AsynchronousRenewableFileCacheBearer.receiver method:

receiver = async_bearer.receiver()
Parameters
bearerThe owning AsynchronousRenewableFileCacheBearer.
max_retriesMaximum number of automatic retry attempts before giving up.
Method __init__ Initialize the receiver.
Method can_retry Decide whether the caller should retry the operation.
Async Method _fetch Fetch a token, forwarding to the parent bearer.
Instance Variable _max_retries Undocumented
Instance Variable _parent Undocumented
Instance Variable _trial 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, bearer: AsynchronousRenewableFileCacheBearer, max_retries: int = 2): (source)

Initialize the receiver.

No I/O is performed during construction.

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

Decide whether the caller should retry the operation.

The receiver inspects provided options and the internal trial count to decide whether to allow another retry. When retries are permitted and the operation was not requested synchronously the receiver will proactively request a background renewal via the parent bearer.

Parameters
err:ExceptionThe exception that occurred during fetch.
options:dict[str, str] | NoneOptional map of string options. Supported keys include OPTION_RENEW_SYNCHRONOUS and OPTION_MAX_RETRIES which can override synchronous behavior and the max retry count.
Returns
boolTrue if the caller should retry, False otherwise.
async def _fetch(self, timeout: float | None = None, options: dict[str, str] | None = None) -> Token: (source)

Fetch a token, forwarding to the parent bearer.

The method increments an internal trial count used by can_retry and delegates the actual fetch to the parent bearer's AsynchronousRenewableFileCacheBearer.fetch method.

Parameters
timeout:float | NoneOptional timeout forwarded to the parent fetch.
options:dict[str, str] | NoneOptional fetch options forwarded to the parent.
Returns
TokenA Token instance.
_max_retries = (source)

Undocumented

Undocumented

Undocumented