Skip to main content

No project description provided

Project description

A simple package to make retry loops easier

Usage:

from retimer import Timer
import time

timer = Timer(10)
while timer.not_expired:
    # do something for 10 seconds
    
    if retry_doing_something:
                time.sleep(.5) # good if something is a request to a server or cpu intensive
        continue
    if something_bad:
        timer.explode()
    
    # all good so we break before timer expires
    break
    
if timer.expired:
    print("Could not do something after tried for 10 seconds")
else:
    print("Successfully did something after 10 seconds")
    

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

retimer-0.1.0.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

retimer-0.1.0.1-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

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