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.61.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c19d82c72c7b93e2c0481d4c8bbcf1d7ab26c39550f834486acc63d5e2a9380 |
|
MD5 | 51c3e16d8baeb128ff206a4424c9be0d |
|
BLAKE2b-256 | d124a96429d529ca5ff0ba57898e64d40763ad4c940fd67bab2b8002e1828a73 |
Hashes for asgi_tools-0.61.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06f6f74ad8553b9ecc92ca0fed177123a2cdde7edd95e11531b162fa30e46c99 |
|
MD5 | 714444a5e8372d0891d7a5b88a6220a2 |
|
BLAKE2b-256 | 8ec7610709c3075e4ef46c21a35ccc3fb7c42ff671310b83052a59cde1385071 |
Hashes for asgi_tools-0.61.6-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9c411f4437566852cd0ff22852638a5d54530d60aafce51c025554c9c3e3917 |
|
MD5 | 38901336fdcec4f74213ac852345b3d3 |
|
BLAKE2b-256 | 83f93bfb9522784a381375a29a262b706bc4b552efe2309f58ecc6f474cce8f7 |
Hashes for asgi_tools-0.61.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fabf8cece7a6dc3c2d92bc2158785e46e827884802a36b13ef5d09f92157e75 |
|
MD5 | 1c78f77abe72a085b5cc81548d0937e3 |
|
BLAKE2b-256 | 948c642ae60e1121635d74d413c118176948966b82b36804a63c4b3742871ab7 |
Hashes for asgi_tools-0.61.6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80a8bc5cc669b0d3ffea9c3f9ffc57ed2fb5c050d3cafc6b4875bf50a25bd445 |
|
MD5 | 2bfa77ce08764156bad0021ca2330001 |
|
BLAKE2b-256 | 7ae90c9f1417e78489757be347c76c0f77ac90c35bc99b2015a10145e26a0bcf |
Hashes for asgi_tools-0.61.6-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e04bc87af6444a6c1c66fd0bdb868f92d4672250c64575a9c901787102c1f96c |
|
MD5 | 00883d613c5f1029394e91b169ba627b |
|
BLAKE2b-256 | 7a57c5f23672568feb498ee97ff7b244f5c3af8a1c273b3cb2e2e691a8e4336b |
Hashes for asgi_tools-0.61.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe49710f48fa8173aed96b95b80e038e02f84583002f7f421ce4d0de025e6927 |
|
MD5 | 4632ae0193efe4226254ba66bea9b94d |
|
BLAKE2b-256 | 35972cd57252bde0d03f84909f3c545f93090ae9b4dd7b828cf6c63d56c05f8a |
Hashes for asgi_tools-0.61.6-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b64e85a99c043ac8384e592e44d57afed7813bf203e8b714fbe4dcd56fcb8e3f |
|
MD5 | 82943fc0265d7e3d3a369a5a57a585e1 |
|
BLAKE2b-256 | 4fa03905394620696d0f8b36e8a5266e097d85cfec2b271546ef995dc16a0ede |
Hashes for asgi_tools-0.61.6-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dcdcc63a8432a71992dc9bbbae936e7a2f330a3fb5a93132e8a35bf28caf055 |
|
MD5 | 7c2e470f27330173aca116687ca6eaa6 |
|
BLAKE2b-256 | 8c29185e2bb3cc2cec4841ffa44de596d9bbee637c88a4a0511ac01a49548e90 |