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.1.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.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: retry_decorator_mt-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 20e4094c05cd16aee80061215cf7d33b9df5725c2c5915756f8b0afd9220ddff
MD5 22d7f6189c12c1989d98a93af82cb4a5
BLAKE2b-256 675d53cf6edd519c56d17d6cd4caed5507a1453382c5fc0489c4b7e044283a19

See more details on using hashes here.

Provenance

The following attestation bundles were made for retry_decorator_mt-1.0.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for retry_decorator_mt-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d3e55f3c5e63a69cedcf8f74c74ad5dac8a5b3177fd91797a70166df8b37bb6
MD5 92193c1c2501c04a649916c4b05d6ba3
BLAKE2b-256 4478771c5413a7adcc32d49cc457f68cdd2ae0b63f39c74e61bcb78ac7a7e321

See more details on using hashes here.

Provenance

The following attestation bundles were made for retry_decorator_mt-1.0.1-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