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.2.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for retimer-0.1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cec88ec56c2ed635d12bb802902ac794728490d03f7e7ac418df9dbec607bd8 |
|
MD5 | 337e9ebff33c54a64b178f23a67cf567 |
|
BLAKE2b-256 | 1dc8a058670a4e7e4ae78f8837aab4bfacb9148caa1c4412543940bf924c4427 |