qbraid.api.PostForcelistRetry
- class PostForcelistRetry(total=10, connect=None, read=None, redirect=None, status=None, other=None, allowed_methods=frozenset({'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE'}), status_forcelist=None, backoff_factor=0, backoff_max=120, raise_on_redirect=True, raise_on_status=True, history=None, respect_retry_after_header=True, remove_headers_on_redirect=frozenset({'Authorization', 'Cookie'}), backoff_jitter=0.0)[source]
Custom
urllib3.Retry
class that performs retry onPOST
errors in the force list. Retrying ofPOST
requests are allowed only when the status code returned is on theSTATUS_FORCELIST
. WhilePOST
requests are recommended not to be retried due to not being idempotent, retrying on specific 5xx errors through the qBraid API is safe.- __init__(total=10, connect=None, read=None, redirect=None, status=None, other=None, allowed_methods=frozenset({'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE'}), status_forcelist=None, backoff_factor=0, backoff_max=120, raise_on_redirect=True, raise_on_status=True, history=None, respect_retry_after_header=True, remove_headers_on_redirect=frozenset({'Authorization', 'Cookie'}), backoff_jitter=0.0)
Methods
__init__
([total, connect, read, redirect, ...])from_int
(retries[, redirect, default])Backwards-compatibility for the old retries format.
get_backoff_time
()Formula for computing the current backoff
get_retry_after
(response)Get the value of Retry-After in seconds.
increment
([method, url, response, error, ...])Overwrites parent class increment method for logging.
is_exhausted
()Are we out of retries?
is_retry
(method, status_code[, has_retry_after])Indicate whether the request should be retried.
new
(**kw)- rtype:
Retry
parse_retry_after
(retry_after)- rtype:
float
sleep
([response])Sleep between retry attempts.
sleep_for_retry
(response)- rtype:
bool
Attributes
DEFAULT
DEFAULT_ALLOWED_METHODS
Default methods to be used for
allowed_methods
DEFAULT_BACKOFF_MAX
Default maximum backoff time.
DEFAULT_REMOVE_HEADERS_ON_REDIRECT
Default headers to be used for
remove_headers_on_redirect
RETRY_AFTER_STATUS_CODES
Default status codes to be used for
status_forcelist