Python Other
Failed to load latest commit information.
aiohttp Allow to disable redirect url re-quoting #1474 Mar 28, 2017
demos update docs Mar 11, 2017
docs Allow to disable redirect url re-quoting #1474 Mar 28, 2017
examples do not use deprecated loop parameter Mar 20, 2017
tests do not add content-disposition header to stremimng request by default #… Mar 27, 2017
vendor/http-parser initial implementation Feb 15, 2017
.coveragerc Improve test coverage Jan 14, 2015
.gitignore rename _parser Feb 18, 2017
.travis.yml back to dev Mar 20, 2017
CHANGES.rst Allow to disable redirect url re-quoting #1474 Mar 28, 2017
CONTRIBUTING.rst update docs Mar 11, 2017
CONTRIBUTORS.txt merge fixes from 2.0 Mar 24, 2017
HISTORY.rst prepare release Mar 20, 2017 some corrections and clarifications in the issue/pr templates. (#911) Jun 4, 2016
LICENSE.txt version and dates Mar 13, 2017 fix CHANGES.{txt,rst} Aug 12, 2016
Makefile test coverage Mar 21, 2017 Update Mar 20, 2017
README.rst prepare release Mar 20, 2017
appveyor.yml change appveyor Mar 20, 2017 build py3.6 wheels Feb 9, 2017
build.cmd Try to fix 64 build on Windows Jan 8, 2016
codecov.yml Shrink codecov range Aug 27, 2016
requirements-ci.txt Update gunicorn from 19.7.0 to 19.7.1 Mar 21, 2017
requirements-dev.txt Update ipython from 5.2.2 to 5.3.0 Mar 14, 2017
requirements-wheel.txt Update pytest from 3.0.6 to 3.0.7 Mar 14, 2017 Update wheel building instructions Jul 14, 2016
setup.cfg check for runtime warnings in tests Mar 23, 2017 update readme Mar 15, 2017
tox.ini Add pyflakes version requirements Oct 6, 2015


Async http client/server framework

aiohttp logo

aiohttp 2.0 release!

For this release we completely refactored low-level implementation of http handling. Finally uvloop gives performance improvement. Overall performance improvement should be around 70-90% compared to 1.x version.

We took opportunity to refactor long standing api design problems across whole package. Client exceptions handling has been cleaned up and now much more straight forward. Client payload management simplified and allows to extend with any custom type. Client connection pool implementation has been redesigned as well, now there is no need for actively releasing response objects, aiohttp handles connection release automatically.

Another major change, we moved aiohttp development to public organization

With this amount of api changes we had to make backward incompatible changes. Please check this migration document

Please report problems or annoyance with with api to


  • Supports both client and server side of HTTP protocol.
  • Supports both client and server Web-Sockets out-of-the-box.
  • Web-server has middlewares and pluggable routing.

Getting started


To retrieve something from the web:

import aiohttp
import asyncio

async def fetch(session, url):
    with aiohttp.Timeout(10, loop=session.loop):
        async with session.get(url) as response:
            return await response.text()

async def main(loop):
    async with aiohttp.ClientSession(loop=loop) as session:
        html = await fetch(session, '')

if __name__ == '__main__':
    loop = asyncio.get_event_loop()


This is simple usage example:

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 wshandler(request):
    ws = web.WebSocketResponse()
    await ws.prepare(request)

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

    return ws

app = web.Application()
app.router.add_get('/echo', wshandler)
app.router.add_get('/', handle)
app.router.add_get('/{name}', handle)


Note: examples are written for Python 3.5+ and utilize PEP-492 aka async/await. If you are using Python 3.4 please replace await with yield from and async def with @coroutine e.g.:

async def coro(...):
    ret = await f()

should be replaced by:

def coro(...):
    ret = yield from f()


Discussion list

aio-libs google group:!forum/aio-libs


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 it's 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 by efficiency, AsyncIO community maintains a list of benchmarks on the official wiki: