Skip to main content

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


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.1.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file timeout_sampler-1.0.1.tar.gz.

File metadata

  • Download URL: timeout_sampler-1.0.1.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

Hashes for timeout_sampler-1.0.1.tar.gz
Algorithm Hash digest
SHA256 81dcf82e1962ca09dce5434450ffe2fe4e5c8a75e7016f9f1e3ab46bf0e0f729
MD5 99f41c49024fd2da6fc5a9baeb060a26
BLAKE2b-256 1460aed1f86a3742c14f1b14589b84b0edd4a3e243090e34154e5f852578957f

See more details on using hashes here.

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