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.56.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2fce0e1e95f2a6e773bca75fd059872d64dd5a0108596c1a432f0d5e88a026f |
|
MD5 | e210592482950a92eac724dbbfa09f06 |
|
BLAKE2b-256 | fbec3d1c382eb7090f2db72a4cd8669d0c6ce580489a85d24ce8bd53913a1da5 |
Hashes for asgi_tools-0.56.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16bc5c8842198e02f86d98b65d3e231396a0ee974fda48b4379d5936e345f177 |
|
MD5 | c83f500c8630e81e1258f7e38b93589b |
|
BLAKE2b-256 | 71ff1f6619edfc3c36e73f3e8d73d3b5ec2e7f1378e2a994dc4e53048a007033 |
Hashes for asgi_tools-0.56.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8cf022232189762da9665b2a2e4638be127305ad0bcd7b40704dd391ed105a3 |
|
MD5 | 5f9530fee4c3e36d337439760118eae6 |
|
BLAKE2b-256 | 44f8a6a4fa86e178ef8af0875a1c3c462936ea8fe63c225c50f45ef5d3aa1f8f |
Hashes for asgi_tools-0.56.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b690b22bed51e262705538687f93dbd836bed2842caf33341dc981ed33cdb90e |
|
MD5 | 2b199d5f70e856d0de06158de9580e31 |
|
BLAKE2b-256 | be87a1f0f857f52cb138699c75ade8195572d896c61666d4ea112ec31946f9bd |
Hashes for asgi_tools-0.56.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8add7901dec06eafd0c80b703fcc3f3ec61d3081f969ad65f2b88c07c0c0e69 |
|
MD5 | 7224d2dd52386ee1c010cd9d3cf711ee |
|
BLAKE2b-256 | 1c307cf02ae7d3687f18162723f88e3ee9df147dad5c0dd9ab2d15f8e5b6e300 |
Hashes for asgi_tools-0.56.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce523f04df0e0ff8383be4725f98a26aa5af7c8f73ac0a6e9897cb692b199bcd |
|
MD5 | c0452a1486c5731a7b1155386d61fde2 |
|
BLAKE2b-256 | dcee57846645c23bda83a7f18cf244b921e795f61d2a2a87392f160cfca7ae5d |
Hashes for asgi_tools-0.56.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e625e6ca311515b523613b5d7e16e7dbd473c748854bc359d6754f324ed785c |
|
MD5 | 020aa6273ac61a0d06823b6ab94043b8 |
|
BLAKE2b-256 | 1b2a3b3d07279541d3e573bfd3b54595c5de7f651a7bdf125ea0badd9afc5b0e |
Hashes for asgi_tools-0.56.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16e4e8f7f20daf2a94fed773c2f7d0d0e819f8a736d30092c67ce3ecb7f47814 |
|
MD5 | 5bcf9831a0a974be2e679fb056bc2fcc |
|
BLAKE2b-256 | 3522f316091b3e3391f2ce70d2dc46358fd87577d27b46e57fa8f3fe6b43c6c0 |
Hashes for asgi_tools-0.56.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 888fe21f8ce0e3f32ed276acffda1b34196f3493f6a4515b17aa68d481d91499 |
|
MD5 | ff5aedf6faf4bac21f2d836aa381036e |
|
BLAKE2b-256 | 64321b198b1d0b6a2a7846e32d34901827cf67d30b2aa0efe93e156990d6be64 |