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.7-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 909c627d61327eb098ebc2fd0fbe1c63c055cd252c32822b6d564b1d45581541 |
|
MD5 | 8f461845f6176f317ed5e4393dd19180 |
|
BLAKE2b-256 | 41cc6257cd8a578bb12ccd39c53e084271b0220c5d47e5d53f4ffecd032cb198 |
Hashes for asgi_tools-0.61.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70032a11c2441d242832aa281f9b729554db9991b499120c6f7c9e6e084f4d42 |
|
MD5 | 1d2b655beb8038690ca4bd874c7b1efe |
|
BLAKE2b-256 | 775347d4b46b3963b63690cd982fd82db984d0289fdf30b2d0691f60fba4a42e |
Hashes for asgi_tools-0.61.7-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b149e912d0f7ead415eb897dd7d155021f33e6bedb89efa29f64e45cafbcc2f5 |
|
MD5 | b6441dc1124466c0fdd1b4d70a010e33 |
|
BLAKE2b-256 | 0f2b323af8b325f03d2217ee7b07330c3701a18eea4ed73de7e53bccdbf684fd |
Hashes for asgi_tools-0.61.7-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e97a31dde846661d84b4458ea78c61d51617a9ca08d5d76b7c5fe1ef4e5950c2 |
|
MD5 | 1b953ec89c23eb1836f4cd69a5b8d523 |
|
BLAKE2b-256 | 10d1968489200cb8b0dd5d9a7a1ad975f7dc66940bc67d899001b111042be19c |
Hashes for asgi_tools-0.61.7-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 300065b550f4c67e1ace964b89ab1215675ead4534a31fd6157047486a5f6001 |
|
MD5 | 33fa8f31d0e9d9291f48251a350b6c5b |
|
BLAKE2b-256 | aa1725dcba4b2c42542a8a34f7f53b55c46c97988f947ea5a49a6466efb7e668 |
Hashes for asgi_tools-0.61.7-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97f96f833175ee16b047f883da442ef8298111f0342c2eaba4e1586fa98063d8 |
|
MD5 | 41fc16dffcda390b9bf057d70843f643 |
|
BLAKE2b-256 | 98ead8eac0565fa06832972bbab3214eae00552ab169e7fe08e8d3d0b9d1a50d |
Hashes for asgi_tools-0.61.7-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e02e7185347ffc83af8554d42291051304b30ec52b67747a861fcaf0a38a4f28 |
|
MD5 | b3d3b6a29597133546af95210f62994b |
|
BLAKE2b-256 | f28ef7bf52be09f97ef8af179a1286330246bb2bb4dc6f0619d7beffe083a600 |
Hashes for asgi_tools-0.61.7-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32c533a5c047a6dd3ba806b745da60c7bd7838f74f3ed7dce2bd068988608709 |
|
MD5 | 166b315cd8790e945285147ad5c765d8 |
|
BLAKE2b-256 | 867b12b650249f9f4e9a12577267bab42ef41137abb8c2bb4358160b4498519b |
Hashes for asgi_tools-0.61.7-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d932e32eaf396302c441bc4084d77c32a0afabb13ef76433fbb2115c51646ede |
|
MD5 | 05df36a0d9aec51dfdbbf71b47382049 |
|
BLAKE2b-256 | 6c5c236b7e48ac2fd64d979bc2c9626926ed64c9819ea894f8ead44f4031a807 |