Skip to main content

Yet another retry utility in Python

Project description

avereno

Yet another retry utility in Python, avereno being the Malagasy word for retry.

Usage

$ python3 -m pip install avereno
$ python3
from random import random
def a_sometimes_failing_hello():
    if random() < 0.5:
      print("Hello!")
    else:
      raise RuntimeError()

from avereno import retry
retry(a_sometimes_failing_hello, on_retry=lambda __1, __2: print("Oops..."))
> Oops...
> Oops...
> Oops...
> Hello!

Features

The retry policy can be customized through the following arguments, as described in help(avereno.retry):

Optional Keyword Arguments:
  max_retries:        number of retries after which GiveUpRetryError will be raised
  max_sleep:          cumulated sleep (backoff) after which GiveUpRetryError will be raised
  on_retry:           function to invoke _before_ each retry
  init_backoff:       initial backoff that will potentially increase afterwards
  backoff_multiplier: multiplication factor between consecutive backoffs
                      set it to  1 for constant backoff
                      set it to >1 for exponential backoff

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avereno-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

avereno-0.1.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file avereno-0.1.2.tar.gz.

File metadata

  • Download URL: avereno-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for avereno-0.1.2.tar.gz
Algorithm Hash digest
SHA256 43e6bf07fd5d443f29998a818796d122710a679a9645edfea0f027e40433d57b
MD5 7af1c684b094779ce5af4b409ae23875
BLAKE2b-256 29b2f52ef5718e61c830258787bae4b09d424cb8379eca01a69505acec1557f7

See more details on using hashes here.

File details

Details for the file avereno-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: avereno-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for avereno-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a98b2e5528fe5e38e1eace9929640ec15a110626241b6318b5b47ebfe02164ac
MD5 d0e3f3ed9635c2a178a49d824dea83fa
BLAKE2b-256 0f1364e1ab3d741b8fc7cd6ad5c6bb394cf4a965707c6b906a3cb47e8c4a6dca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page