Skip to main content

A simple decorator for retry functions

@retry(ValueError, KeyError,
         retry = True, 
         attempts = 3,
         wait = 1,
         reraise = True,
         logger = logging.debug
         )
def func():
   pass

Decorator parameters

exceptions

SPECIFIED exception types.

retry

if retry is True , retry when the decorated function throws the SPECIFIED exceptions.
if retry is False , retry when the decorated function throws the UNSPECIFIED exceptions.
Default is True.

attempts

The number of retries attempted. Default is 3.

wait

The wait interval between retries (second).
Default is 1 second.

reraise

If reraise is True, when an exception is thrown by the decorated function, that exception will be rethrown. If raraise is False, then None is returned instead.
Default is True.

logger

The logger function will be used when the decorated function raise exception. Default is logging.warning.

Metadata

Release files for decorator-retry 0.1.9

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

Source distribution (sdist)

Source distribution for decorator-retry 0.1.9
File Size Uploaded
decorator_retry-0.1.9.tar.gz 2.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for decorator-retry 0.1.9
File Interpreter ABI Platform
decorator_retry-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 kB

Release files / decorator_retry-0.1.9.tar.gz

Download URL decorator_retry-0.1.9.tar.gz
Size 2.1 kB
Tags Source
SHA-256 checksum
How to use checksums
44d3756434f999e063da56a06dd7dee4cd9e747349e2d6fac6d8a76c26472982
BLAKE2b-256 checksum
How to use checksums
e4eae3e53769e0a9e007f2e4f29e962d58c678be6cb08cb9d513a8d40c20cd62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.0rc1 Linux/5.15.0-107-generic

Release files / decorator_retry-0.1.9-py3-none-any.whl

Download URL decorator_retry-0.1.9-py3-none-any.whl
Size 2.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae79f996dfd9c258f4db3c89b8413707cffe216f1e1bc27d8d9c2d1ea9c7b239
BLAKE2b-256 checksum
How to use checksums
e56bb8042fa7b5f779ea250e83e5f93e5ba3871bd9a9f3937333df7f6ac872cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.0rc1 Linux/5.15.0-107-generic

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

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