Timeout utility class to wait for any function output and interact with it in given time
Project description
TimeoutSampler
Utility class for waiting to any function output and interact with it in given time.
Installation
pip3 install timeout-sampler
Usage
from random import randint
from timeout_sampler import TimeoutSampler
def random_number(start, end):
return randint(start, end)
samples = TimeoutSampler(
wait_timeout=60,
sleep=1,
func=random_number,
start=1,
end=10,
)
for sample in samples:
if sample == 5:
break
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
timeout_sampler-1.0.0.tar.gz
(3.7 kB
view details)
File details
Details for the file timeout_sampler-1.0.0.tar.gz
.
File metadata
- Download URL: timeout_sampler-1.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f30fdf7ebfc05a05773fbda4803cc677f11652a18d2eaca100da281942d83380 |
|
MD5 | d35252ae280762fa987e3c3df3e076ea |
|
BLAKE2b-256 | 702a34f11bce765c2291b78825bfe9a45ea05e9d3a1c2b9c16386b1c2bb70558 |