Random timeout between minimum and maximum values
Project description
Timeout
Random timeout between minimum and maximum values
Installation:
pip install python-timeout
Usage:
from timeout import random_timeout, sleep
random_timeout(10, 20) # Random timeout between 10 and 20 seconds
random_timeout(from_minutes=1, to_minutes=2) # Random timeout between one and two minutes
random_timeout(from_hours=1, to_hours=2) # Random timeout between one and two hours
random_timeout(from_days=3, to_days=7) # Random timeout between one and two hours
random_timeout(1) # Random timeout for around one second
random_timeout(from_hours=1) # Random timeout for around one hour
sleep(5) # Sleep for five seconds
sleep(minutes=15) # Sleep for fifteen minutes
sleep(hours=2) # Sleep for two hours
from timeout import SleepTimer
during_active_time = SleepTimer('8am', '10pm').during_active_time
if during_active_time(): # Only active between certain time range
run()
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
python-timeout-6.2.tar.gz
(4.8 kB
view details)
File details
Details for the file python-timeout-6.2.tar.gz
.
File metadata
- Download URL: python-timeout-6.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 557ddb8496ebce3852306ae52e75e94b32c6ccb6e4893798a23af73e11ee04ee |
|
MD5 | 33a0711312626274bc5bf08a98013897 |
|
BLAKE2b-256 | f0bf227de85114bc4ef6b59aa7c9f85b2ceb96b75e5f02a11673a152e63a65d4 |