Registry / http-networking / aiohttp

aiohttp

JSON →
library3.14.3pypypi✓ verified 26d ago

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 aiohttp
INSTALL
IMPORT
SIG · AIOHTTP
A
aiohttp
http-networkingpythonv3.14.3
Install
4.8s avg
Import
587ms
Disk
35MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.14.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.623s · 34.6MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 4.8s · import 0.551s · 38MB
35MB installed
● package 35MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ClientSession
from aiohttp import ClientSession
import aiohttp
web
from aiohttp import web
import aiohttp
ClientTimeout
from aiohttp import ClientTimeout
import aiohttp

Client with ClientTimeout and basic web server setup.

import aiohttp import asyncio async def main(): timeout = aiohttp.ClientTimeout(total=30) async with aiohttp.ClientSession(timeout=timeout) as session: async with session.get('https://httpbin.org/get') as resp: print(resp.status) data = await resp.json() print(data) asyncio.run(main()) # Server from aiohttp import web async def handle(request): return web.Response(text='Hello') app = web.Application() app.add_routes([web.get('/', handle)]) web.run_app(app)
Debug
Known issues
breakingtimeout= parameter must be aiohttp.ClientTimeout, not int/float. Passing timeout=30 raises AttributeError: 'int' object has no attribute 'total' at request time, not at session creation. The error is confusing and delayed.
fix
timeout = aiohttp.ClientTimeout(total=30, connect=10)
async with aiohttp.ClientSession(timeout=timeout) as session: ...
affects: >= 3.9
breakingloop= parameter removed from ClientSession, TCPConnector, and all other aiohttp objects. Was deprecated for years; removed in 3.9. LLM-generated code from older tutorials passes loop=asyncio.get_event_loop().
fix
Remove all loop= arguments. aiohttp uses the running event loop automatically.
affects: >= 3.9
breakingread_timeout and conn_timeout constructor parameters removed from ClientSession. Replaced by ClientTimeout.
fix
Use aiohttp.ClientTimeout(total=..., connect=..., sock_read=...) instead.
affects: >= 3.9
breakingverify_ssl=, ssl_context=, and fingerprint= parameters deprecated in request methods. Replaced by unified ssl= parameter.
fix
Use ssl=False to skip verification, ssl=ssl_context for custom context, ssl=aiohttp.Fingerprint(...) for fingerprint pinning.
affects: >= 3.9
deprecatedapp.loop, request.loop, client.loop, connector.loop properties deprecated and scheduled for removal in aiohttp 4.0.
fix
Use asyncio.get_event_loop() or asyncio.get_running_loop() directly.
affects: >= 3.9
gotchaCreating ClientSession outside of an async context (e.g. at module level or in __init__) raises DeprecationWarning and will raise RuntimeError in a future version.
fix
Always create ClientSession inside an async function or use async with at the point of use.
affects: all
gotchaResponse body must be consumed before the response context manager exits, or the connection is left in a broken state. await resp.json() / await resp.text() / await resp.read() must be called inside the async with block.
fix
Always consume the response body inside the async with session.get(...) as resp: block.
affects: all
Upgrade
Version history
3.14.3latest on PyPI · released Jul 23, 2026
Audit
Dependencies
aiodnsoptionalFaster DNS resolution. Included in aiohttp[speedups]. Highly recommended.
brotlioptionalBrotli decompression support. Included in aiohttp[speedups].
Agent activity
84 hits · last 30 days
node
76
OpenAI (training)
1
Resources