Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Aiohttp | 13,376 | 7,355 | 4,894 | a day ago | 220 | November 14, 2021 | 499 | other | Python | |
Asynchronous HTTP client/server framework for asyncio and Python | ||||||||||
Httpx | 10,229 | 32 | 1,424 | 2 days ago | 58 | May 23, 2022 | 42 | bsd-3-clause | Python | |
A next generation HTTP client for Python. 🦋 | ||||||||||
Uvicorn | 6,292 | 357 | 849 | 21 hours ago | 143 | June 27, 2022 | 40 | bsd-3-clause | Python | |
An ASGI web server, for Python. 🦄 | ||||||||||
Nonebot2 | 3,920 | a day ago | 21 | June 20, 2022 | 14 | mit | Python | |||
跨平台 Python 异步聊天机器人框架 / Asynchronous multi-platform chatbot framework written in Python | ||||||||||
Pulsar | 1,841 | 34 | 1 | 3 years ago | 65 | December 29, 2017 | 27 | bsd-3-clause | Python | |
Event driven concurrent framework for Python | ||||||||||
Nonebot | 1,807 | 5 | 4 | 7 months ago | 21 | September 28, 2021 | 10 | mit | Python | |
基于 OneBot 标准的 Python 异步 QQ 机器人框架 / Asynchronous QQ robot framework based on OneBot for Python | ||||||||||
Aioquic | 1,236 | 9 | 2 days ago | 36 | February 03, 2022 | 22 | bsd-3-clause | Python | ||
QUIC and HTTP/3 implementation in Python | ||||||||||
Blacksheep | 1,200 | 5 | 5 | 4 days ago | 49 | May 15, 2022 | 30 | mit | Python | |
Fast ASGI web framework for Python | ||||||||||
Python Proxy | 967 | 5 | 4 | a year ago | 138 | May 09, 2021 | 31 | mit | Python | |
HTTP/HTTP2/HTTP3/Socks4/Socks5/Shadowsocks/ShadowsocksR/SSH/Redirect/Pf TCP/UDP asynchronous tunnel proxy implemented in Python 3 asyncio. | ||||||||||
Socketify.py | 921 | 2 days ago | 28 | mit | Python | |||||
Bringing Http/Https and WebSockets High Performance servers for PyPy3 and Python3 |
To get something from the web:
import aiohttp
import asyncio
async def main():
async with aiohttp.ClientSession() as session:
async with session.get('http://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())
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/server_simple.py
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)])
if __name__ == '__main__':
web.run_app(app)
https://aiohttp.readthedocs.io/
Feel free to make a Pull Request for adding your link to these pages!
aio-libs Discussions: https://github.com/aio-libs/aiohttp/discussions
gitter chat https://gitter.im/aio-libs/Lobby
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 (https://www.getkeepsafe.com) for its support in the early days of the project.
The latest developer version is available in a GitHub repository: aio-libs/aiohttp
If you are interested in efficiency, the AsyncIO community maintains a list of benchmarks on the official wiki: https://github.com/python/asyncio/wiki/Benchmarks