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
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
Hashes for decorator_retry-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 571b26bd26c9ea0b217b79824aecf7c5465b9ad86a58869acdd284aa2eba0ff7 |
|
MD5 | c4583bd0faeec9f12ec3fc1a69cd02cc |
|
BLAKE2b-256 | e2ef28167425a567f3bb75aaa7c474243801cdd14a9b41210243f7b1aadb12d8 |