Skip to main content

No project description provided

Project description

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.

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

decorator_retry-0.1.7.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

decorator_retry-0.1.7-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file decorator_retry-0.1.7.tar.gz.

File metadata

  • Download URL: decorator_retry-0.1.7.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.0rc1 Linux/5.15.0-107-generic

File hashes

Hashes for decorator_retry-0.1.7.tar.gz
Algorithm Hash digest
SHA256 6e9dd054a41c9d6760c1e95195ec6835c53c2d3885d8bb0f497c742bd1da2a21
MD5 b9df70edda3823bf630e9cd1bc4b5b62
BLAKE2b-256 770497916debec7038a3e20ee0ea7a6573b0149f3fbb45f14a10d2c4ed5fc14b

See more details on using hashes here.

File details

Details for the file decorator_retry-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: decorator_retry-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.0rc1 Linux/5.15.0-107-generic

File hashes

Hashes for decorator_retry-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7df02a59a6f493e21adba7c03e5534fb3ad7add456924fa80783028c3392be63
MD5 0f265c3908e67ce2c2020051e5a61f06
BLAKE2b-256 05d2abd1d8e0017ddacfce6e3c0830b2fafacac2feee80c29c92f5fdd9613958

See more details on using hashes here.

Supported by

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