Timeout context manager for asyncio Python
Project description
aiotimeout
Timeout context manager for asyncio Python
Usage
from aiotimeout import timeout
# Will raise an asyncio.TimeoutError
with timeout(1):
await asyncio.sleep(1.5)
# Will not raise anything
with timeout(1):
await asyncio.sleep(0.5)
Differences to alternatives
-
asyncio.wait_for
does not offer a context manager. In some cases a context manager is clearer. -
asyncio.wait_for
creates/uses an extra task. In some cases this is not necessary, and an extra task adds non-determinism in terms of sequence of operations. -
Clearer internal code [in the author's opinion]. Rather than a custom class, contextlib.contextmanager is used.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiotimeout-0.0.3.tar.gz
(1.8 kB
view details)
Built Distribution
File details
Details for the file aiotimeout-0.0.3.tar.gz
.
File metadata
- Download URL: aiotimeout-0.0.3.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4938c78ff12ea5ab06263660dfa186606ad3c69639dba6ce66feaa65a6cb6a2 |
|
MD5 | 1f19c3ba2f03967415a015444f6fec95 |
|
BLAKE2b-256 | 32a34a8dfb3e3fc7ef3c5303754e237d25dac2050e87a1d90f3b66621982820a |
File details
Details for the file aiotimeout-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: aiotimeout-0.0.3-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0289122c8d73958ba99a4040c0338fcc2dec2efc6c65b437eff3884db8d97e84 |
|
MD5 | e33e45a1f6b3e8a5d4e89653694e68d0 |
|
BLAKE2b-256 | c78ef08bf325916cfa595f59a3af39693aedf1e62d23d5b54fa638bbd7a27f51 |