LoggingRetry#
API documentation for tradingstrategy.alternative_data.coingecko.LoggingRetry Python class in Trading Strategy framework.
- class LoggingRetry[source]#
Bases:
Retry
In the case we need to throttle Coingecko, be verbose about it.
Methods
__init__
(*args, **kwargs)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, ...])Return a new Retry object with incremented retry counters.
is_exhausted
()Are we out of retries?
is_retry
(method, status_code[, has_retry_after])Is this method/status code retryable? (Based on allowlists and control variables such as the number of total retries to allow, whether to respect the Retry-After header, whether this header is present, and whether the returned status code is on the list of status codes to be retried upon on the presence of the aforementioned header)
new
(**kw)parse_retry_after
(retry_after)sleep
([response])Sleep between retry attempts.
sleep_for_retry
([response])Attributes
DEFAULT
Retry configuration.
DEFAULT_ALLOWED_METHODS
Default methods to be used for
allowed_methods
DEFAULT_BACKOFF_MAX
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
- increment(method=None, url=None, response=None, error=None, _pool=None, _stacktrace=None)[source]#
Return a new Retry object with incremented retry counters.
- Parameters:
response (
HTTPResponse
) – A response object, or None, if the server did not return a response.error (Exception) – An error encountered during the request, or None if the response was received successfully.
- Returns:
A new
Retry
object.