{"id":341,"library":"async-timeout","title":"async-timeout: Timeout Context Manager for Asyncio Programs","description":"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.","status":"active","version":"5.0.1","language":"python","source_language":"en","source_url":"https://github.com/aio-libs/async-timeout","tags":["asyncio","timeout","asynchronous programming","Python 3.8+"],"install":[{"cmd":"pip install async-timeout","lang":"bash","label":"Install async-timeout"}],"dependencies":[{"reason":"Required for asynchronous programming in Python","package":"asyncio","optional":false}],"imports":[{"note":"Ensure correct import path to avoid ImportError","symbol":"Timeout","correct":"from async_timeout import timeout"}],"quickstart":{"code":"import asyncio\nfrom async_timeout import timeout\n\nasync def main():\n    async with timeout(10):\n        await asyncio.sleep(5)\n        print('Completed within timeout')\n\nasyncio.run(main())","lang":"python","description":"Demonstrates usage of the timeout context manager to set a 10-second timeout for an asynchronous operation."},"warnings":[{"fix":"Update your code to use the new 'timeout' function signature and behavior.","message":"Version 5.0.0 introduced changes to the 'timeout' function, making it fully compatible with the standard 'asyncio.Timeout'.","severity":"breaking","affected_versions":"5.0.0"},{"fix":"Upgrade your Python environment to version 3.7 or higher.","message":"Support for Python 3.6 was dropped in version 4.0.3.","severity":"deprecated","affected_versions":"4.0.3"}],"env_vars":null,"search_vec":"'3.8':39 '5.0.1':29 'allow':18 'async':2 'async-timeout':1 'asynchron':25,36 'asyncio':8,16,34 'code':26 'context':5,13 'current':27 'easi':20 'maintain':30 'manag':6,14,21 'program':9,17,37 'provid':10 'python':38 'regular':32 'timeout':3,4,12,23,35 'updat':33 'version':28","created_at":"2026-03-28T10:51:17.829825+00:00","updated_at":"2026-04-15T21:19:28.587585+00:00","problems":[{"fix":"Install the module using pip: 'pip install async-timeout'.","cause":"The 'async_timeout' module is not installed in the Python environment.","error":"ModuleNotFoundError: No module named 'async_timeout'"},{"fix":"Ensure you have the latest version installed: 'pip install --upgrade async-timeout'.","cause":"The 'timeout' function is not available in the 'async_timeout' module, possibly due to an outdated version.","error":"ImportError: cannot import name 'timeout' from 'async_timeout'"},{"fix":"Verify the installation and version: 'pip show async-timeout' and upgrade if necessary.","cause":"The 'timeout' attribute is missing from the 'async_timeout' module, likely due to an incorrect installation or version.","error":"AttributeError: module 'async_timeout' has no attribute 'timeout'"},{"fix":"Pass the timeout duration as the first positional argument, for example: `async with timeout(5.0):` instead of `async with timeout(timeout=5.0):`.","cause":"This issue arises when calling the `timeout` context manager with a keyword argument named `timeout`, while the function expects the duration as a positional argument or a different keyword like `delay`.","error":"TypeError: timeout() got an unexpected keyword argument 'timeout'"},{"fix":"Handle the `asyncio.TimeoutError` exception using a `try...except` block, increase the `timeout` duration if the operation legitimately takes longer, or optimize the underlying asynchronous code to complete faster.","cause":"The asynchronous operation wrapped by the `async_timeout.timeout` context manager did not complete within the specified time limit, causing a `asyncio.TimeoutError` to be raised.","error":"asyncio.TimeoutError"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"5.0.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/aio-libs/async-timeout","docs":null,"changelog":null,"pypi":"https://pypi.org/project/async-timeout/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}