Skip to content

The easiest python retry module with context, for lazy people.

yoshiso/retrykit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

retrykit

The python retry module with context for lazy people. You don't need to write another method to decorate it with retry wrapper.

Install

pip install retrykit

Usage

The simplest way

from retrykit import retry


for ctx in retry().trial():
    with ctx:
        # Retres if exception occurs on the scope of this context
        do_your_operation()

With setting for retry

from retrykit import retry


for ctx in retry(exc=ValueError, tries=3, backoff=2).trial():
    with ctx:
        # retries 3 times at most, only when ValueError occurs
        do_your_operation()

Also support decorator style.

from retrykit import retry


@retry(exc=ValueError)
def my_operation():
  pass

About

The easiest python retry module with context, for lazy people.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages