Retry Decorators
- util.retry(exception_classes=None, tries=10, delay=5, rate=1.3)
Retry a call against an endpoint <tries> time
- Parameters:
exception_classes – tuple | The Exceptions to be caught
tries – int | How often the call should be retried
delay – float | The delay after an error was caught
rate – float | The rate to increment delay by
Returns:
- util.sp_retry(tries=10, delay=5, rate=1.3)
This is a shorthand for retry that catches all exceptions thrown by this library
Retry a call against an endpoint <tries> time :param exception_classes: :param tries: :param delay: :param rate:
Returns:
- util.throttle_retry(tries=10, delay=5, rate=1.3)
This is a shorthand for retry that catches SellingApiRequestThrottledException
Retry a call against an endpoint <tries> time :param exception_classes: :param tries: :param delay: :param rate:
Returns:
The example below will retry the call when a throttled exception was thrown:
@throttle_retry(tries=10, delay=5, rate=1.3)
def get_orders(**kwargs):
return Orders().get_orders(**kwargs)
The example below will return all pages, retrying each call up to <times> times
@sp_retry(tries=10, delay=10, rate=1.2)
@load_all_pages()
def get_orders(**kwargs):
return Orders().get_orders(**kwargs)