async-timeout: Timeout Context Manager for Asyncio Programs
Provides a timeout context manager for asyncio programs, allowing for easy management of timeouts in asynchronous code. Current version: 5.0.1. Maintained with regular updates.
Warnings
- breaking Version 5.0.0 introduced changes to the 'timeout' function, making it fully compatible with the standard 'asyncio.Timeout'.
- deprecated Support for Python 3.6 was dropped in version 4.0.3.
Install
-
pip install async-timeout
Imports
- Timeout
from async_timeout import timeout
Quickstart
import asyncio
from async_timeout import timeout
async def main():
async with timeout(10):
await asyncio.sleep(5)
print('Completed within timeout')
asyncio.run(main())