Need help with aiohttp?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

11.7K Stars 1.7K Forks Other 7.4K Commits 428 Opened issues


Asynchronous HTTP client/server framework for asyncio and Python

Services available


Need anything else?

Contributors list


Async http client/server framework

.. image:: :height: 64px :width: 64px :alt: aiohttp logo


.. image:: :target: :alt: GitHub Actions status for master branch

.. image:: :target: :alt: status for master branch

.. image:: :target: :alt: Latest PyPI package version

.. image:: :target: :alt: Downloads count

.. image:: :target: :alt: Latest Read The Docs

.. image:: :target: :alt: Discourse status

.. image:: :target: :alt: 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:

.. code-block:: python

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], "...")

loop = asyncio.geteventloop() loop.rununtilcomplete(main())

This prints:

.. code-block::

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

Coming from

_ ? Read
why we need so many lines 


An example using a simple server:

.. code-block:: python

# 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': web.run_app(app)



External links

  • Third party libraries
  • Built with aiohttp
  • Powered by aiohttp

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.


  • Python >= 3.7
  • async-timeout_
  • chardet_
  • multidict_
  • yarl_

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

.. chardet: .. _aiodns: .. _multidict: .. _yarl: .. _async-timeout: .. _cChardet:


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:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.