Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 4 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

aiohttp

Async HTTP client/server framework for Python with WebSocket support.

HTTP clients and networkingPYPI

GitHubWebsite

1. License

License from PyPI license expression.

github.com/aio-libs/aiohttp

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What aiohttp does

aiohttp is one asyncio library that covers both sides of HTTP, a client and a web server, with WebSockets on each side built in. The project behind it dates to 2013.

aiohttp popularity

81 / 100
Gid Score, #80 overall
134M
downloads a week, pypi
16.6K
GitHub stars
125
agent projects use it
aiohttp: downloads per weekPyPI, aiohttp 132,538,080
aiohttp: GitHub starsaio-libs/aiohttp 16,618

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How aiohttp is used

  • aiohttp is a dependency in 125 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (7.7% of the 1,623 Python ones), #6 of 126 in http clients and networking.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,864; those are left out of every share on this page.
  • The most used alternative in our scan is httpx (280 projects).
  • Projects that use it most often also use python-dotenv (76.0%), Pydantic (68.0%), Requests (63.2%).

By coding agent

64 projects, 2.0%
58 projects, 1.9%
50 projects, 2.0%
13 projects, 2.7%
11 projects, 3.3%
8 projects, 2.9%
7 projects, 1.5%
5 projects, 1.5%

Often used with

In 76.0% of its projects
In 68.0% of its projects
In 63.2% of its projects
In 59.2% of its projects
In 57.6% of its projects
In 45.6% of its projects
In 43.2% of its projects
In 41.6% of its projects

aiohttp in practice

Strengths

Client and server in one package

The same install gives you an HTTP client and a web server. The README's examples cover both: a <code>ClientSession</code> request and a small <code>web.Application</code> with routes.

WebSockets on both ends, no callbacks

The README says WebSocket support works out of the box for client and server and "avoids Callback Hell". In its server example, a handler receives messages with <code>async for msg in ws</code> and replies with <code>send_str</code> or <code>send_bytes</code>.

Middleware on the client too

The web server has middlewares, signals and pluggable routing. The docs also list client middleware for customizing request and response processing.

A written deprecation window

The docs promise that a deprecated public API keeps working for at least a year and a half after the release that deprecates it. Every deprecation raises <code>DeprecationWarning</code>.

Watch out for

More code than requests

The README and docs point people coming from requests to a page titled "why we need so many lines". The session and the response are both opened with <code>async with</code> blocks.

Fast DNS is a separate install

aiodns is optional, but the README calls it "highly recommended for sake of speed". Brotli compression on the client also needs an extra package, Brotli or brotlicffi.

The compatibility rule has exceptions

The maintainers write that they sometimes break their own deprecation rule. Their example is a critical bug that cannot be fixed without a major API change.

Fetch a page with ClientSession

import aiohttp
import asyncio

async def main():

    async with aiohttp.ClientSession() as session:
        async with session.get('https://python.org') as response:

            print("Status:", response.status)
            print("Content-type:", response.headers['content-type'])

            html = await response.text()
            print("Body:", html[:15], "...")

asyncio.run(main())

More about aiohttp

Funding
  • GitHub Sponsors: https://github.com/aio-libs
  • GitHub Sponsors: https://github.com/asvetlov
  • GitHub Sponsors: https://github.com/webknjaz
  • GitHub Sponsors: https://github.com/Dreamsorcerer
  • Open Collective: https://opencollective.com/aiohttp
  • Tidelift: https://tidelift.com/funding/github/pypi/aiohttp
  • Own page: https://opencollective.com/aio-libs
  • 7 GitHub sponsors

See all

Head to head
Packages around it
  • python-dotenv: .env file loader
  • requests: Synchronous HTTP client
  • pydantic: Data validation
  • solders: Solana types and bindings
  • websockets: WebSocket library
  • solana: Solana Python SDK
More in HTTP clients and networking

Alternatives

aiohttp This page

Apache-2.0 AND MITGid 81134M/wk

httpx

Modern Python HTTP client with async support, replacing the standard requests library.

BSDGid 78198M/wk

websocket-client

WebSocket client library for Python with low-level API options.

Apache-2.0Gid 6941.6M/wk

Compare aiohttp with another tool

Get started

Install it.

pip install aiohttp

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## aiohttp
- Make requests inside `async with aiohttp.ClientSession() as session:`, open each response with `async with session.get(...) as response:`, and `await response.text()` for the body.
- Do not create a `ClientSession` outside of an event loop; the docs FAQ calls this dangerous.
- Install `aiohttp[speedups]`, or at least `aiodns`, which the docs call highly recommended for DNS speed.
- Run with `python -X dev` during development. aiohttp then uses a strict client parser and adds extra warnings.
- Treat `DeprecationWarning` from aiohttp as a to-do. Deprecated APIs are kept for at least a year and a half, then can go away.
- For servers, register handlers with `app.add_routes([web.get(...)])` and start with `web.run_app(app)`. For WebSockets, create `web.WebSocketResponse()` and `await ws.prepare(request)` before reading messages.
- On 3.14.4 and later, raise `client_max_fields` on `web.Application` if forms can exceed 1000 fields; otherwise they get a 413.