Skip to main content

Timeout wrapper

https://badge.fury.io/py/timeout_wrapper.png https://pypip.in/d/timeout_wrapper/badge.png

Timeout decorator with defaults and exceptions.

Documentation

Usage of this decorator is really simple - to set the timeout, just add @timeout(time) decorator to your function definition:

@timeout(3)  # 3 seconds
def myfunc(..):
    ..

If the myfunc() call timeouts, TimeoutException is raised.

Optionally, you can also set your own message for exception:

@timeout(3, exception_message="Oh noez")
def myfunc(..):
    ..

or use default value, instead of exception:

@timeout(3, False):
def myfunc(..):
    ..

Thats all.

Changelog

0.1.0

  • Project created.

Metadata

Release files for timeout_wrapper 0.1.0

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

Source distribution (sdist)

Source distribution for timeout_wrapper 0.1.0
File Size Uploaded
timeout_wrapper-0.1.0.tar.gz 3.6 kB Details

Release files / timeout_wrapper-0.1.0.tar.gz

Download URL timeout_wrapper-0.1.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9a4430d0f1664ad55c64e22e3cf113214cbfe7292a41632cbf4c88dcb52fde20
BLAKE2b-256 checksum
How to use checksums
c9cba5353866b8c11b500ee38f2cf200b353ca556c69009e543ed48603a26a32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

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