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
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
retimer-0.1.0.1.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for retimer-0.1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bccc33c6d3cd4046cfc74378ca7922f67ca702e3dc58c20f4704c9cca0312a52 |
|
MD5 | 4e7456be8c810bc74c8b2ff91a7f9c5e |
|
BLAKE2b-256 | 6f04f798d76182eb9f7d83945f2527b41a9c1fad828ab13050c41989dcba4cc0 |