roboto.http.options#
Module Contents#
- class roboto.http.options.HttpClientOptions#
Behavior of a
HttpClient, applied to every request it makes.- logging: HttpLoggingOptions#
- retry: HttpRetryOptions#
- class roboto.http.options.HttpLoggingOptions#
How a
HttpClientrenders requests into its logs.- scrub_headers: Sequence[str] = ()#
Header names, compared case-insensitively, whose values are replaced with
*in every rendered form of a request the client produces.Authorizationis always scrubbed, with or without an entry here.
- class roboto.http.options.HttpRetryOptions#
Whether and how many times a
HttpClientretries a failed request.- max_attempts: int = 10#
the first attempt always runs.
- Type:
Total attempts per request, first try included. Values below 1 behave as 1
- predicate: RetryPredicate | None = None#
Called with the request and the exception a failed attempt raised;
Truemeans try again.Nonekeeps the default,is_expected_to_be_transient(), which retries failures expected to be transient: DNS resolution failures unconditionally; connection errors, timeouts, and retryable HTTP statuses according to the request’s idempotency.
- roboto.http.options.RetryPredicate#
Decides whether the exception warrants another attempt at the request.
- roboto.http.options.never_retry(_request, _exc)#
Retry predicate giving every request exactly one attempt.
Use for calls whose side effect must not run twice and where the server offers no idempotency key: a retried delivery (a chat message, an email) lands as a duplicate.
- Parameters:
_request (roboto.http.request.HttpRequest)
_exc (BaseException)
- Return type:
bool