Is a toolkit to build ASGI applications faster
Project description
asgi-tools – Is a really lightweight ASGI Toolkit to build ASGI applications faster.
Documentation is here: https://klen.github.io/asgi-tools
ASGI-Tools is designed to be used as an ASGI Toolkit to quickly build really lightweight ASGI applications/middlewares/tools.
For instance these middlewares were built with the library:
Features:
Supports all most popular async python libraries: Asyncio, Trio and Curio
Request – Parse ASGI scope, get url, headers, cookies, read a request’s data/json/form-data
Response – Send HTTP (text, html, json, stream, sse, file, http errors) responses
ResponseWebsocket – Work with websockets
RequestMiddleware – Parse a scope and insert the parsed request into the scope
ResponseMiddleware – Parse responses and convert them into ASGI messages
RouterMiddleware – Route HTTP requests
LifespanMiddleware – Process a lifespan cycle
StaticFilesMiddleware – Serve static files from URL prefixes
asgi_tools.tests.TestClient – A test client with websockets support to test asgi applications
App – A simple foundation for ASGI apps
Requirements
python >= 3.7
ASGI-Tools belongs to the category of ASGI web frameworks, so it requires an ASGI HTTP server to run, such as uvicorn, daphne, or hypercorn.
Installation
asgi-tools should be installed using pip:
pip install asgi-tools
A Quick Example
You can use any of ASGI-Tools components independently.
Dispite this ASGI-Tools contains App helper to quickly build ASGI applications. For instance:
Save this to app.py.
from asgi_tools import App
app = App()
@app.route('/')
async def hello(request):
return "Hello World!"
Run it with uvicorn
$ uvicorn app:app
Bug tracker
If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/asgi-tools/issues
Contributing
Development of the project happens at: https://github.com/klen/asgi-tools
License
Licensed under a MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for asgi_tools-0.52.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76917bc860897cc463260273302f12482ee150441eb758296b07cfdb7f3eae06 |
|
MD5 | 81f1be4634747f4b2f9e34f220150a3e |
|
BLAKE2b-256 | b31d7910a564cc5e2c2243a608b8c5ec7a8b84ca0a745a67611c3e06f0ae4c0f |
Hashes for asgi_tools-0.52.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc690b29c011dd85865a59a8111b4a4ef8b8059b37bfe7aa98711a9c2d022194 |
|
MD5 | 4cf7ca2fd028023dcb24c76e67355bf7 |
|
BLAKE2b-256 | 789128b0aec622bf5944095ed675189b97ba0302b25e445ce95c22661daf3c92 |
Hashes for asgi_tools-0.52.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1a4e743e8ac8367812aebd3541981826bceb8eb91571d3f93a3ea274208367b |
|
MD5 | 5838c266bd6cbda013abb5a596c41461 |
|
BLAKE2b-256 | c0d75e00366ff658a92250ab8728a125b6e31b3368e2eefef64a916870e775d0 |
Hashes for asgi_tools-0.52.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43862855430809c538472345235b56595ed105876da176a680e19d6fd061ace2 |
|
MD5 | 705fadb84b0837c558e194bdd53d7958 |
|
BLAKE2b-256 | 3d373f2480bba4741b01bdda80fb56ae2f2f4eae9051794bcd792f2cc9c02a49 |
Hashes for asgi_tools-0.52.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59a223dd20cc32d4bc720253b165d84bfff7561a4f7a2215738437edaccb9955 |
|
MD5 | 7c5e996da84bb87ac15e68e12ab984a0 |
|
BLAKE2b-256 | 726dc64377368715137d22b8a2ae8e7544b27d38ece4806bbf14f395a5a3628e |
Hashes for asgi_tools-0.52.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c0a6a48efe11fcf3d81fcb0fdc4e4932a99a2b0bc09402067ee2f5a9930b5f1 |
|
MD5 | e0156e8379c6878a2405c7857dd601a0 |
|
BLAKE2b-256 | 8448b61a2d084f37a4a8ac39000608d9efff291e8f029c70b1ea5035b6b870bb |
Hashes for asgi_tools-0.52.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cb5ab0bff807c9219cfdbc7a144694cec310fcb272e0d416e9b9d36e70b3d0b |
|
MD5 | f0b9820d4a0133616d34ca5716518daa |
|
BLAKE2b-256 | a41773b37788ebeebef3eab99d26e90599cefd42790c90fd0fe055c372d9797e |
Hashes for asgi_tools-0.52.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74dfc2a449fd05e6a5525a3ef27e9d94136d36578b932a1dcc0bf5f87747ec91 |
|
MD5 | 103fa57d89a803a49f68ffe77a12b6e4 |
|
BLAKE2b-256 | ee72a28b813f75cb87ccedff64cd68104f689945f7a557455815b1bedc938814 |
Hashes for asgi_tools-0.52.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4273ea832e816a87cf50f3c0ba4de014ffec48ba00370279399f462df6487d84 |
|
MD5 | fa297c86ecf411b1e9fd85b93a1fed2a |
|
BLAKE2b-256 | f48a920a959b388e23be5a9dcbfff6c0d1d1c727f1196bc1dea53e071b36f823 |