aiohttp

3.13.3 · active · verified Wed Mar 25

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.

Warnings

Install

Imports

Quickstart

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)

view raw JSON →