Registry / devops / python-timeout

python-timeout

JSON →
library6.2pypypi✓ verified 82d ago

A simple Python library to add a random timeout between a minimum and maximum duration. Current version 6.2, sporadically maintained.

pip install python-timeout
INSTALL
IMPORT
SIG · PYTHON-TIMEOUT
P
python-timeout
devopspythonv6.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

random_timeout
from timeout import random_timeout
from python_timeout import random_timeout
sleep
from timeout import sleep
SleepTimer
from timeout import SleepTimer

Generate a random timeout between 1.5 and 3.0 seconds.

import os from python_timeout import random_timeout timeout = random_timeout(minimum=1.5, maximum=3.0) print(f'Timeout set to {timeout} seconds')
Debug
Known issues
gotchaThe library does not actually pause execution; it only returns a random float. You must implement sleep yourself using time.sleep.
fix
Wrap the returned value in time.sleep() to actually wait.
affects: *
gotchaThe import path uses underscores (python_timeout) despite the package name containing a hyphen.
fix
Use 'from python_timeout import random_timeout'.
affects: *
Upgrade
Version history
6.2latest on PyPI · released Jul 28, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
python-timeout — pip install python-timeout · libregistry