You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sviatoslav Sydorenko 7bf5fa4878
Suppress LegacyVersion deprecation @ pytest
4 days ago
.github Stop blocking CI tests with linting 1 week ago
CHANGES Add a change note to PR #6872 4 days ago
aiohttp Fixed ClientConnectorError docstring (#6846) 2 weeks ago
docs Stop installing cchardet speedup under >Python 3.9 1 week ago
examples Add aioredis for type checking examples (#6553) 6 months ago
requirements Bump coveragepy to v6.4.2 1 week ago
tests Suppress LegacyVersion deprecation @ pytest 4 days ago
tools Bump black to fix CI (#6675) 4 months ago
vendor http-parser -> llhttp (#6144) 10 months ago
.cherry_picker.toml Fix cherry-picker config 4 years ago
.codecov.yml Last attempt to delay codecov reports (#5973) 12 months ago
.editorconfig Dont inherit web exceptions for web.Response (#3462) 4 years ago
.git-blame-ignore-revs Ignore black commits in `git blame` (#6825) 4 weeks ago
.gitattributes Reformat git files 2 years ago
.gitignore http-parser -> llhttp (#6144) 10 months ago
.gitmodules Bump llhttp version to 6.0.6 10 months ago
.lgtm.yml Cleanup lgtm errors (#3902) 3 years ago
.mypy.ini Remove legacy examples (#5625) 10 months ago
.pre-commit-config.yaml [] pre-commit autoupdate (#6790) 2 months ago
.readthedocs.yml Implement future changelog previews in the docs (#6055) 10 months ago
CHANGES.rst Typing Errors Fixed (#6415) 8 months ago Create 4 years ago
CONTRIBUTING.rst Fix typos (#6464) 8 months ago
CONTRIBUTORS.txt Add Path support on web app run (#6843) 3 weeks ago
HISTORY.rst Spelling fixes (#5897) 10 months ago
LICENSE.txt Update copyright year from 2020 to 2022 (#6601) 6 months ago Type annotations (#3049) 4 years ago
Makefile Makefile: replace which(1) with more portable `command -v` (#6784) 2 months ago
README.rst fix DeprecationWarning (#6749) 3 months ago
pyproject.toml Set the minimum required `setuptools` to v46.4.0 (#6225) 9 months ago
setup.cfg Update setup.cfg 6 days ago Convert type comments to type annotations (#6410) 8 months ago


Async http client/server framework

aiohttp logo

GitHub Actions status for master branch status for master branch

Latest PyPI package version

Downloads count

Latest Read The Docs

Discourse status

Chat on Gitter

Key Features

  • Supports both client and server side of HTTP protocol.
  • Supports both client and server Web-Sockets out-of-the-box and avoids Callback Hell.
  • Provides Web-server with middlewares and plugable routing.

Getting started


To get something from the web:

import aiohttp
import asyncio

async def main():

    async with aiohttp.ClientSession() as session:
        async with session.get('') as response:

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

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

This prints:

Status: 200
Content-type: text/html; charset=utf-8
Body: <!doctype html> ...

Coming from requests ? Read why we need so many lines.


An example using a simple server:

# examples/
from aiohttp import web

async def handle(request):
    name = request.match_info.get('name', "Anonymous")
    text = "Hello, " + name
    return web.Response(text=text)

async def wshandle(request):
    ws = web.WebSocketResponse()
    await ws.prepare(request)

    async for msg in ws:
        if msg.type == web.WSMsgType.text:
            await ws.send_str("Hello, {}".format(
        elif msg.type == web.WSMsgType.binary:
            await ws.send_bytes(
        elif msg.type == web.WSMsgType.close:

    return ws

app = web.Application()
app.add_routes([web.get('/', handle),
                web.get('/echo', wshandle),
                web.get('/{name}', handle)])

if __name__ == '__main__':



Feel free to make a Pull Request for adding your link to these pages!

Communication channels

aio-libs discourse group:

gitter chat

We support Stack Overflow. Please add aiohttp tag to your question there.


Optionally you may install the cChardet and aiodns libraries (highly recommended for sake of speed).


aiohttp is offered under the Apache 2 license.


The aiohttp community would like to thank Keepsafe ( for its support in the early days of the project.

Source code

The latest developer version is available in a GitHub repository:


If you are interested in efficiency, the AsyncIO community maintains a list of benchmarks on the official wiki: