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.49.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56c4c386615b01dd9cf09911e796e76340d5a78bc0514c77fa65f768d86d666c |
|
MD5 | fecd9d26b481c41d9258e37372946e62 |
|
BLAKE2b-256 | 71b82d5cafb40e180a165d560d88d50ace9d8391cabeed1a0c8cee26886d77a4 |
Hashes for asgi_tools-0.49.4-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51aaf68fc10a571c0059093eee1fc9f82fec836d0733dc98ba1998c0f8598cc9 |
|
MD5 | abf6d8133789cd2f0026c453d646e42c |
|
BLAKE2b-256 | 7cc6310dc6d2dd7293222ecda9866abf6b449e16947c44f52468797d836fb7f0 |
Hashes for asgi_tools-0.49.4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b541e52a4fd08b6bdfb4348d2766f2b3ae16bcae07ce5e203b6eb2ade8214455 |
|
MD5 | cbbf23b3e471962abf5e1b3c49ee4f32 |
|
BLAKE2b-256 | 592d0bd4a3bf921f117b155a9b4d1924b9aa9f975bf345b2e8968db367ac576e |
Hashes for asgi_tools-0.49.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35df9d84de8ee64a0a107c5d5f2540354a2de3f3e33675501e87a33af146450e |
|
MD5 | 2ebe2c59e6d8831cec954de8d44c10d6 |
|
BLAKE2b-256 | d80ce9b1fe733bc3dabe4c01bd3ca220dd5325f3c3e7e1e61965e40f34327175 |
Hashes for asgi_tools-0.49.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f55cd559106584851495899517359147914fea0b82df849e0fc887cfff5c4598 |
|
MD5 | 6b610bf360d0f2c78d3f6d25d56280e1 |
|
BLAKE2b-256 | af2a21a9b260a511fe836f8fded823fe671702d860621d27dd899d59195db3bd |
Hashes for asgi_tools-0.49.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6c1303ee34c297a3a03b365137e98de7f4abfb7b92fff39917616ccf699d782 |
|
MD5 | 6e9873da078e8f7136b99655909b689d |
|
BLAKE2b-256 | 159940e7c05ae2a86494776f791845a19c53a06bec26e34f73a2e81c4e8f5385 |
Hashes for asgi_tools-0.49.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59625b1cebda1534aa616d107f29a9c853272715be2c5ef8eaf8686358a12cc4 |
|
MD5 | 5a90ea7731d1633ff987d0b7bd018332 |
|
BLAKE2b-256 | 02c8e1a539f6f54d5f4df93c8f9dd92e251fe0cf0a1eb0537a4586581807c7c4 |
Hashes for asgi_tools-0.49.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1ddb1d29c2d74fe2a612f8fda2bee0c88d1ebda31814d41451351870c3ccc44 |
|
MD5 | 7d2ea16752e4422534ceab80750bb398 |
|
BLAKE2b-256 | 9de3cd313d7a4d96bc23fbeeb509a2f92a6722bbd868df10992200d66b3d890a |
Hashes for asgi_tools-0.49.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 853b80bcd5be549f340891ba2d218a60082f4d2b9b535cd4382b73876073701b |
|
MD5 | 58157986bc4523dc9c27ccc30cd23b97 |
|
BLAKE2b-256 | 8d3767b65ab09c24d65dd5a79b28d51213205133cf13e3c6cebacc3189142443 |