Skip to main content

Decorator to allow for retry of th decorated object if a given exception is raised

Project description

retry-decorator

A retry python decorator to handle a given set of errors and to retry the decorated function n times if error is in set of errors

Installation

pip install retry-decorator

how to use

Here is an exemple on how to use the decorator

from RetryDecorator import retry

@retry(n_retry=2, tts=0.1)
def func_to_retry(raise_error: bool = True):
    if raise_error:
        print("error is raised")
        
        raise Exception("test exception")
    
    print("error not raised")

    return True

def exemple():
    try:
        func_to_retry()

    except Exception as e:
        print(e)

    func_to_retry(False)

    return

exemple()

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

retry_decorator_mt-1.0.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

retry_decorator_mt-1.0.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file retry_decorator_mt-1.0.0.tar.gz.

File metadata

  • Download URL: retry_decorator_mt-1.0.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for retry_decorator_mt-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9ba205239154183ec372715c403bfae8599571631f55a015a2d81eeffccfd416
MD5 461b905c16a190c64d0d4328cbd9bf72
BLAKE2b-256 202385e8b027b93dd5b7e859ab589079abf0378553b634b17f7c20aed30e9ceb

See more details on using hashes here.

Provenance

The following attestation bundles were made for retry_decorator_mt-1.0.0.tar.gz:

Publisher: publish-to-test-pypi.yml on The-Faust/retry-decorator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file retry_decorator_mt-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for retry_decorator_mt-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f14dd329257da57cd9713b49c95e9aef7ca184978c4eec8d1ce8c3d47d84d5f
MD5 19440d3a5fa099155313cf6381bc739c
BLAKE2b-256 25fa081d1fd246586964ccfbc3fcce0673df82ed6c05e96d5e230917574463e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for retry_decorator_mt-1.0.0-py3-none-any.whl:

Publisher: publish-to-test-pypi.yml on The-Faust/retry-decorator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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