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)