Async http client/server framework
Key Features
Supports both client and server side of HTTP protocol.
Supports both client and server Web-Sockets out-of-the-box without the Callback Hell.
Web-server has middlewares and pluggable routing.
Getting started
Client
To retrieve something from the web:
import aiohttp
import asyncio
async def fetch(session, url):
async with session.get(url) as response:
return await response.text()
async def main():
async with aiohttp.ClientSession() as session:
html = await fetch(session, 'http://python.org')
print(html)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Server
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 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(msg.data))
elif msg.type == web.WSMsgType.binary:
await ws.send_bytes(msg.data)
elif msg.type == web.WSMsgType.close:
break
return ws
app = web.Application()
app.add_routes([web.get('/', handle),
web.get('/echo', wshandle),
web.get('/{name}', handle)])
web.run_app(app)
Documentation
Demos
External links
Feel free to make a Pull Request for adding your link to these pages!
Communication channels
aio-libs google group: https://groups.google.com/forum/#!forum/aio-libs
Feel free to post your questions and ideas here.
gitter chat https://gitter.im/aio-libs/Lobby
We support Stack Overflow. Please add aiohttp tag to your question there.
Requirements
Python >= 3.5.3
Optionally you may install the cChardet and aiodns libraries (highly recommended for sake of speed).
License
aiohttp is offered under the Apache 2 license.
Keepsafe
The aiohttp community would like to thank Keepsafe (https://www.getkeepsafe.com) for it’s support in the early days of the project.
Source code
The latest developer version is available in a github repository: https://github.com/aio-libs/aiohttp
Benchmarks
If you are interested in by efficiency, AsyncIO community maintains a list of benchmarks on the official wiki: https://github.com/python/asyncio/wiki/Benchmarks
Changelog
3.2.0 (2018-05-06)
Features
Raise TooManyRedirects exception when client gets redirected too many times instead of returning last response. (#2631)
Extract route definitions into separate web_routedef.py file (#2876)
Raise an exception on request body reading after sending response. (#2895)
ClientResponse and RequestInfo now have real_url property, which is request url without fragment part being stripped (#2925)
Speed up connector limiting (#2937)
Added and links property for ClientResponse object (#2948)
Add request.config_dict for exposing nested applications data. (#2949)
Speed up HTTP headers serialization, server micro-benchmark runs 5% faster now. (#2957)
Apply assertions in debug mode only (#2966)
Bugfixes
expose property app for TestClient (#2891)
Call on_chunk_sent when write_eof takes as a param the last chunk (#2909)
A closing bracket was added to __repr__ of resources (#2935)
Fix compression of FileResponse (#2942)
Fixes some bugs in the limit connection feature (#2964)
Improved Documentation
Drop async_timeout usage from documentation for client API in favor of timeout parameter. (#2865)
Improve Gunicorn logging documentation (#2921)
Replace multipart writer .serialize() method with .write() in documentation. (#2965)
Deprecations and Removals
Deprecate Application.make_handler() (#2938)
Misc
#2958
Metadata
Release files for aiohttp 3.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiohttp-3.2.0.tar.gz | 719.7 kB | Without provenance | Details for aiohttp-3.2.0.tar.gz |
Built distributions (wheels)
Total release size: 7.9 MB
Release files / aiohttp-3.2.0.tar.gz
| Download URL | aiohttp-3.2.0.tar.gz |
|---|---|
| Size | 719.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1be3903fe6a36d20492e74efb326522dd4702bf32b45ffc7acbc0fb34ab240a6
|
|
BLAKE2b-256 checksum How to use checksums |
0e1bfd86244ef0c1c6c18581a7cbd37535f8a59054e73fbd52227c37b1c5a0d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp36-cp36m-win_amd64.whl
| Download URL | aiohttp-3.2.0-cp36-cp36m-win_amd64.whl |
|---|---|
| Size | 419.5 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8aa12ad9cccbdf0f896dd3f1bbe78093b09eb1a456cbd7208080c2c0e9c338e1
|
|
BLAKE2b-256 checksum How to use checksums |
2a17f234a648ee32e5fe8cdd15db893c21b5c7dab302e6d903c8aa13ff310cc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp36-cp36m-win32.whl
| Download URL | aiohttp-3.2.0-cp36-cp36m-win32.whl |
|---|---|
| Size | 405.5 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
57854a9e1f0ed26acfd5765caa5522679b6e78a4dfcd137855cd058fdae5abe2
|
|
BLAKE2b-256 checksum How to use checksums |
9ec556af4b0fcb6473dc0620e513c6b5ece58fc6ce34078573fc021c00b513de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | aiohttp-3.2.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 761.0 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
695dc053980c9ad73030d426de40d7d0c66f4226c698b1c68ae94b9b761f28bd
|
|
BLAKE2b-256 checksum How to use checksums |
fffb33dd1b634c1aa837afce8aa259a83d6b294581442d727f13a3baf39f608c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp36-cp36m-manylinux1_i686.whl
| Download URL | aiohttp-3.2.0-cp36-cp36m-manylinux1_i686.whl |
|---|---|
| Size | 735.5 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
af183773b170da552bfb1f78bc84647e3f7316ff5c77ae379e34362ffbafed0b
|
|
BLAKE2b-256 checksum How to use checksums |
817eaf3ecef7ad5e216efc55111043bfa600127207ea477b0604999e2d6a6b1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp36-cp36m-macosx_10_12_x86_64.whl
| Download URL | aiohttp-3.2.0-cp36-cp36m-macosx_10_12_x86_64.whl |
|---|---|
| Size | 421.3 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ee39b92c1dc2425784b424bd442bd255f31e272546be92a28035dabe9da3495e
|
|
BLAKE2b-256 checksum How to use checksums |
81db93769be1bc3d1dc58b859f11a1e2eb2d1db0a8927d00ffa626ce0df70f4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp36-cp36m-macosx_10_11_x86_64.whl
| Download URL | aiohttp-3.2.0-cp36-cp36m-macosx_10_11_x86_64.whl |
|---|---|
| Size | 429.8 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.11+ x86-64 |
|
SHA-256 checksum How to use checksums |
233b9a7816d29700e4ae6e024e0cc5d9d6fbd2a9b0878d0c89b75fa708a8b204
|
|
BLAKE2b-256 checksum How to use checksums |
5e4702b2e08e41b25c209051ae1069743395d15bddd7a98ca5a736a7fe1a184c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp36-cp36m-macosx_10_10_x86_64.whl
| Download URL | aiohttp-3.2.0-cp36-cp36m-macosx_10_10_x86_64.whl |
|---|---|
| Size | 431.8 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.10+ x86-64 |
|
SHA-256 checksum How to use checksums |
424ad41a5434c25920fc8d0ce24c2f8d749965bce8996b86c9be0cd50f0051b2
|
|
BLAKE2b-256 checksum How to use checksums |
5dc051a3ac413149913a7dab019e5b5bb464c4e7fc04868515158e59dcc7ba6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp35-cp35m-win_amd64.whl
| Download URL | aiohttp-3.2.0-cp35-cp35m-win_amd64.whl |
|---|---|
| Size | 417.6 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
51652ba1310e5a71a20133976ae6cbe301edce3387c6d3df4a8451841af8c9c7
|
|
BLAKE2b-256 checksum How to use checksums |
3cd3aff2e50a3233271581963531b6406f2291129b7321faef3d47062d71b048
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp35-cp35m-win32.whl
| Download URL | aiohttp-3.2.0-cp35-cp35m-win32.whl |
|---|---|
| Size | 403.9 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
b6abeb48f66ac26690fb681cc3c1f9eed1d2f9f29b7cd4f3e182d3276001f663
|
|
BLAKE2b-256 checksum How to use checksums |
d247d063068486ae7e096d0160452c0101ce50c4fb2e3b43d4b612eb9994954d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | aiohttp-3.2.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 745.5 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
ef885a19bcff2a20ae0362ab6b8f8ac62b8bd8490dd3e031f15933abbe41d2b2
|
|
BLAKE2b-256 checksum How to use checksums |
059aeded1423b19063c8a06457a0bfd69a070b320f1fba67797449e65dc7ffa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp35-cp35m-manylinux1_i686.whl
| Download URL | aiohttp-3.2.0-cp35-cp35m-manylinux1_i686.whl |
|---|---|
| Size | 720.0 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
4af32e7641f8029fd2cb6b3d3e51e92074ae0d42347d56e93b25fbb3f49a43bb
|
|
BLAKE2b-256 checksum How to use checksums |
929c2bf432249bb57bf87e07842b458fac130d44dd7d8fb536154ac3edf46bc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp35-cp35m-macosx_10_12_x86_64.whl
| Download URL | aiohttp-3.2.0-cp35-cp35m-macosx_10_12_x86_64.whl |
|---|---|
| Size | 420.5 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
7dc80c5984613a30a6608718a401143598f69907770a46e5b6df87c7b9d06ce8
|
|
BLAKE2b-256 checksum How to use checksums |
60e0019b121318c065e26cdae8ecc9e6f40a32a9dcbee9669d3d5f80b98b13a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp35-cp35m-macosx_10_11_x86_64.whl
| Download URL | aiohttp-3.2.0-cp35-cp35m-macosx_10_11_x86_64.whl |
|---|---|
| Size | 427.4 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.11+ x86-64 |
|
SHA-256 checksum How to use checksums |
46c004a3bd91c42caa1bb9c4d44ef156ccf0d7f56272590da8d066710e7c63be
|
|
BLAKE2b-256 checksum How to use checksums |
7f3d357cc50078db44388b1f451fda586a45bb852aaf4cd876808c481cfaa6d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiohttp-3.2.0-cp35-cp35m-macosx_10_10_x86_64.whl
| Download URL | aiohttp-3.2.0-cp35-cp35m-macosx_10_10_x86_64.whl |
|---|---|
| Size | 429.1 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.10+ x86-64 |
|
SHA-256 checksum How to use checksums |
b034ab3a8e328705625467fe7b3a59e23da6952ba19b5a14b044aef206b653fa
|
|
BLAKE2b-256 checksum How to use checksums |
4abdf57b6d6bb99df7d82b68f48a1713cf3dd6d5fc3e711e1e5c205ad1a81da0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for aiohttp 3.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.