Retry package for Python
Project description
Python Retry
Features
Generic Decorator
Specify stop condition (i.e. limit by number of attempts)
Specify wait condition (i.e. exponential backoff sleeping between attempts)
Customize retrying on Exceptions
Read the docs for further information.
Installation
Install using pip:
pip install python-retry
Example
>>> from python_retry import retry
>>> import pytest
>>>
>>> @retry()
... def div(num: int, den: int):
... return num/den
>>>
>>> div(1, 0)
Advanced use
>>> import logging
>>> logger = logging.getLogger("foo")
>>>
>>> @retry(
... retry_on=(ZeroDivisionError,),
... max_retries=2,
... backoff_factor=1,
... supress_exception=True,
... retry_logger=logger
... )
... def div(num: int, den: int):
... return num / den
>>>
>>> div(1, 0)
Documentation
You can find here at Read the docs the complete documentation.
Changelog
0.0.1 (2022-03-09)
Initial project structure.
Test suite.
Examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file python_retry-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: python_retry-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e1678a05721a7708639adf0b10d4a07fb719906a310514b393a2c83c4b9964d |
|
MD5 | 88e10346a39b3a38d18a81093e1b65a6 |
|
BLAKE2b-256 | 0016442a6ef19877c8f344cdf42219abc735b41187b1904c9f7a2b9a3d823ce1 |