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
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ba205239154183ec372715c403bfae8599571631f55a015a2d81eeffccfd416
|
|
| MD5 |
461b905c16a190c64d0d4328cbd9bf72
|
|
| BLAKE2b-256 |
202385e8b027b93dd5b7e859ab589079abf0378553b634b17f7c20aed30e9ceb
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
retry_decorator_mt-1.0.0.tar.gz -
Subject digest:
9ba205239154183ec372715c403bfae8599571631f55a015a2d81eeffccfd416 - Sigstore transparency entry: 191967632
- Sigstore integration time:
-
Permalink:
The-Faust/retry-decorator@62af4b6914ea45c64c41f1577d07d7ef6dac6924 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/The-Faust
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@62af4b6914ea45c64c41f1577d07d7ef6dac6924 -
Trigger Event:
push
-
Statement type:
File details
Details for the file retry_decorator_mt-1.0.0-py3-none-any.whl.
File metadata
- Download URL: retry_decorator_mt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f14dd329257da57cd9713b49c95e9aef7ca184978c4eec8d1ce8c3d47d84d5f
|
|
| MD5 |
19440d3a5fa099155313cf6381bc739c
|
|
| BLAKE2b-256 |
25fa081d1fd246586964ccfbc3fcce0673df82ed6c05e96d5e230917574463e8
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
retry_decorator_mt-1.0.0-py3-none-any.whl -
Subject digest:
0f14dd329257da57cd9713b49c95e9aef7ca184978c4eec8d1ce8c3d47d84d5f - Sigstore transparency entry: 191967636
- Sigstore integration time:
-
Permalink:
The-Faust/retry-decorator@62af4b6914ea45c64c41f1577d07d7ef6dac6924 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/The-Faust
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@62af4b6914ea45c64c41f1577d07d7ef6dac6924 -
Trigger Event:
push
-
Statement type: