nemoguardrails.http.retry
Bounded retry policies and a transport-neutral retrying HTTP client.
Module Contents
Classes
Functions
API
Configure bounded retries for an HTTP client.
max_attempts includes the initial request. Methods are normalized to
uppercase, and POST is intentionally absent from the safe default set.
Retry-After values are honored only when they fall within
max_retry_after unless clamping is explicitly enabled. Vendor override
headers are ignored unless honor_retry_override_header is enabled.
Return whether the policy permits retrying the HTTP method.
Return a usable Retry-After delay in seconds.
Both delta-seconds and HTTP-date values are supported. Invalid or
out-of-policy values return None so the client uses exponential
backoff instead.
Return whether a response status or opted-in override requests a retry.
Apply a retry policy around another transport-neutral HTTP client.
Closing this wrapper closes the wrapped client only when it implements
:class:ClosableHTTPClient.
Return the underlying client.
Return this client from an asynchronous context manager.
Close wrapped resources when leaving an asynchronous context.
Apply the current retry settings to another client.
Close the wrapped closable client at most once.
Send a request and retry eligible failures within policy bounds.
The returned response includes retry_count in its extensions.
Transport errors also expose their completed retry count before being
re-raised.