Skip to main content

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()

Metadata

Release files for python-timeout 2026.6.30

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-timeout 2026.6.30
File Size Uploaded Provenance Actions
python_timeout-2026.6.30.tar.gz 3.1 kB Without provenance Details for python_timeout-2026.6.30.tar.gz

Release files / python_timeout-2026.6.30.tar.gz

Download URL python_timeout-2026.6.30.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a4d092f5a80a2cf740d940ea2aa184ec6236ee3d8694f83710cc233e9044885e
BLAKE2b-256 checksum
How to use checksums
d8e9a6aa84b2448c5aace92e1b0ecbbdf796c2f17beddc25e661ab6684a5880a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Security for python-timeout 2026.6.30

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2026.6.30 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page