Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

8. Utils

Fatih Kılıç edited this page May 5, 2019 · 1 revision

Currently AnyAPI only have 2 utility

retry_until

I think is really self explaining but if you are wondering how to use it here is how to use it:

from anyapi import AnyAPI
from anyapi.utils import retry_until

def exception_is_something(exception):
    return isinstance(exception, something)

AnyAPI('httpbin.org',
    scoped_calls=[
        retry_until(exception_is_something)
    ]
)

retry

It lets you to retry for X times.

from anyapi import AnyAPI
from anyapi.utils import retry

AnyAPI('httpbin.org',
    scoped_calls=[
        retry(max_retries)
    ]
)
Clone this wiki locally