Skip to main content

Timeouts helper

Project description


Timeout helper tools library for Python


pip3 install timeouter


Simple class usage

import timeouter, time

t = timeouter.Timer(1)
t.has(0.1) # True
t.has(0.6) # False
t.get() # returns remaining time
t.get(laps=3) # returns remaining time, split into 3 equal laps
t.reset() # resets timeout counter

# raises TimeoutError if timer has expired, message is optional

# get remaining time, raise TimeoutError if expired, message is optional
t.get(check=True, check_message=message)

Custom timeout exception

Exception for the single timer object

class MyException(Exception): pass


Default exception for all new timers

class MyException(Exception): pass


Thread-local usage

import timeouter as to

# init for the current thread
# module methods check, get, has, reset, set_timeout and set_exception_class
# are proxied to thread-local object

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

timeouter-0.0.15.tar.gz (2.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page