Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.http.options

Module Contents

HttpClientOptions

class roboto.http.options.HttpClientOptions#View Source

Behavior of a HttpClient, applied to every request it makes.

Attributes

HttpClientOptions.logging

HttpClientOptions.retry

HttpLoggingOptions

class roboto.http.options.HttpLoggingOptions#View Source

How a HttpClient renders requests into its logs.

Attributes

HttpLoggingOptions.scrub_headers

scrub_headers Sequence[str] = () #

Header names, compared case-insensitively, whose values are replaced with * in every rendered form of a request the client produces. Authorization is always scrubbed, with or without an entry here.

HttpRetryOptions

class roboto.http.options.HttpRetryOptions#View Source

Whether and how many times a HttpClient retries a failed request.

Attributes

HttpRetryOptions.max_attempts

max_attempts int = 10 #

Total attempts per request, first try included. Values below 1 behave as 1: the first attempt always runs.

HttpRetryOptions.predicate

predicate RetryPredicate | None = None #

Called with the request and the exception a failed attempt raised; True means try again. None keeps 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.

RetryPredicate

roboto.http.options.RetryPredicate#View Source

Decides whether the exception warrants another attempt at the request.

never_retry()

roboto.http.options.never_retry(_request, _exc)#View Source

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

_exc BaseException

Return type

bool

Was this page helpful?