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.53.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a0b4a11a88610d5d0c11f1d1f2b4d2acada3c8f05e6b0febc13a352d9f8513e |
|
MD5 | 0e178c9493248a86e77049b834cbc46d |
|
BLAKE2b-256 | 46d17e576c5881d0ff9db0869055cd9892ad99d4b3f6ce357e9122bbbe43e54a |
Hashes for asgi_tools-0.53.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a534a6f8260c9a2f26f5258b455d24a3dbc4237fbf2036adddb867118e4480e |
|
MD5 | 63f8bbf1fb02714c9f48970d3486394d |
|
BLAKE2b-256 | 22f57eb6c332d138545d085fe7b3bdbfb50ed5de1a3050f2e8c78b827e03cb71 |
Hashes for asgi_tools-0.53.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d520bd9cdf7e0ed3a148b00eb12dc33b811b6db419f0ab14843a9a5556b521a2 |
|
MD5 | 079bec90c423fccd55a010b7916b91b7 |
|
BLAKE2b-256 | a5757ff5cf38cf1440ec202078abd719861a6d3a957ce565546abe711687cc67 |
Hashes for asgi_tools-0.53.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b23d7bb307d9c9a4ef88b103559fa2a6ef2d7ceec8644ee14fb3a81ec7f59357 |
|
MD5 | 384e7cd697ee56eb3c0b5d6066ca0810 |
|
BLAKE2b-256 | 55bef73dd3d76b4670b19522d1234d3c79104798952769e2de204b16a462e256 |
Hashes for asgi_tools-0.53.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60c1172feda7a0f685d60edc64ed9861d1fe6a3baa62ad5465ee438fcdaf58b9 |
|
MD5 | 4dd7eb4f6d636cf3181cf39c1bb2c9d7 |
|
BLAKE2b-256 | 5ef15f4233e6f45cf3c789d705738f9cbb9ec296442a3a64b94956f15118136b |
Hashes for asgi_tools-0.53.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b4da834300cb2ab376af38466b68160678df233aeb3e67aefd597ed50839dc0 |
|
MD5 | 0d0190dadb87ec2ca2602f05762bc3dc |
|
BLAKE2b-256 | 6397391badb52708ceac4e0de3f64ca23750f039f0b7e7fef6b88873b3a99a38 |
Hashes for asgi_tools-0.53.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 965b595e96c245fac5db554d2f7145d961a9211a5909999f68c36e748db09d14 |
|
MD5 | 5f776d63329e7bded5370939d2494134 |
|
BLAKE2b-256 | c03e8d6e0a5ab7aea9913f99b49b37db41728be3d2790dd6df51cedd5f0f48f4 |
Hashes for asgi_tools-0.53.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c59b4f7f52720fc538227e03c6c12e7eba4910142aefc6d348110cfd6a9b9a8 |
|
MD5 | 87b98c5c341fdaff62d0403d0bb72750 |
|
BLAKE2b-256 | eb0627b3ecfbf7ede752cc1c19709bc552fcc2d73542fff6fed4617708cf6fb1 |
Hashes for asgi_tools-0.53.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81e64c634d466ef45c465ec7f99bd2bb68e4f540bfeab57777287a7a2389d7cf |
|
MD5 | e932b04e56f5adc5faf7b4f7fc639fb7 |
|
BLAKE2b-256 | db0da6f10f5acfa0d6de54486de8d89c1729b59d6e2e252a232667a2cf0100a8 |