Skip to main content

Python Retry

License-MIT Documentation Status GitHub Actions Badge PyPi

Features

  1. Generic Decorator

  2. Specify stop condition (i.e. limit by number of attempts)

  3. Specify wait condition (i.e. exponential backoff sleeping between attempts)

  4. 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.

Metadata

Release files for python-retry 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for python-retry 0.0.1
File Interpreter ABI Platform
python_retry-0.0.1-py3-none-any.whl Python 3 none any Details

Release files / python_retry-0.0.1-py3-none-any.whl

Download URL python_retry-0.0.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e1678a05721a7708639adf0b10d4a07fb719906a310514b393a2c83c4b9964d
BLAKE2b-256 checksum
How to use checksums
0016442a6ef19877c8f344cdf42219abc735b41187b1904c9f7a2b9a3d823ce1
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for python-retry 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page