Async HTTP client/server framework for asyncio. Provides both a client (ClientSession) and a web server (web.Application). Current version is 3.13.3 (Jan 2026). Has removed several long-deprecated parameters that LLMs still generate.
pip install aiohttpVerified import paths — ran on the pinned version, not inferred.
Client with ClientTimeout and basic web server setup.
timeout = aiohttp.ClientTimeout(total=30, connect=10) async with aiohttp.ClientSession(timeout=timeout) as session: ...
Remove all loop= arguments. aiohttp uses the running event loop automatically.
Use aiohttp.ClientTimeout(total=..., connect=..., sock_read=...) instead.
Use ssl=False to skip verification, ssl=ssl_context for custom context, ssl=aiohttp.Fingerprint(...) for fingerprint pinning.
Use asyncio.get_event_loop() or asyncio.get_running_loop() directly.
Always create ClientSession inside an async function or use async with at the point of use.
Always consume the response body inside the async with session.get(...) as resp: block.