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.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acf7dd46bfa8a222911cb1d63cc146b8ad9936e39a10db8b9bbd28fbccc756ca |
|
MD5 | 1018e300239c1685f140562101864262 |
|
BLAKE2b-256 | 669e8d27d655f2e81391e356ca870ed53d9ea6d0d394bc8f0630eb37711400e1 |
Hashes for asgi_tools-0.61.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f47ca81118e77315ae7b075f4ec32513df9efbcde0d57cd95b424c70fe6e0d55 |
|
MD5 | cdeabd0731074ce2b1ec34b1e3956d1a |
|
BLAKE2b-256 | e8cc871672c7a98515eef6d4fce77fe0443e3f2bc1d03269484302b7a728cc50 |
Hashes for asgi_tools-0.61.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25072a455722dfb069b00a02c31a81e288aa249cbd16fb10aac3bae4d62c8183 |
|
MD5 | 2f72b5a4d122a1f4c8959e06e2285dc6 |
|
BLAKE2b-256 | 75ac4afa1f7d2313cb8d353d59c3dc3a5e507b2b59ef9f38ab5837f42f7d583b |
Hashes for asgi_tools-0.61.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c9695818119c233e3e8856e628ed8b478392b6aaa64f48daf7ff668cb1c62f1 |
|
MD5 | 2544efce7170348b3de18c46a3fb67ff |
|
BLAKE2b-256 | 7461d899832fedc7d4219dd3618bb26f5e6ddb7b0bb41ad9a8448c5f72107be4 |
Hashes for asgi_tools-0.61.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ba3d59855009a7ded45384ee244910958a09273bfc93a8cd9924b1e05ce7959 |
|
MD5 | 7117f7480c08d5b76ae385965c91a937 |
|
BLAKE2b-256 | 2bb96d80523db7157126083b9eea61269e3785b676f9889cec1695925e50bab9 |
Hashes for asgi_tools-0.61.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 668777f1491571789ba73d0058d0068f556fdff7b1ae770ed209fb476fd80ad1 |
|
MD5 | bd565d3ccfe0f6fcd945e937cbad75f5 |
|
BLAKE2b-256 | 259305cf1bd1c313faef292c4170d66ef0e5604cdd5397dd34e142f198153faf |
Hashes for asgi_tools-0.61.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8556c5a273584d9e87b287bdd2dbe9ff06d9d02f8df5c3b9d4a78ecec7773ee5 |
|
MD5 | f7cc8eedc6196df408090cada348e636 |
|
BLAKE2b-256 | cc5659af3a183e00c2ff983a4ec4b601588417ccbb9c2f0dbe8e74df9d74d7fe |
Hashes for asgi_tools-0.61.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 073eed89affd9412f2f2ea0c3073642baa8f2b182fee6acf63ee04b1a6b2a5dc |
|
MD5 | 2ea0c4119fc6953f7a9c572ed610ffc9 |
|
BLAKE2b-256 | 1b6ec64422030b2efce9066ba7df197749cd4a6f6acb99a197e65dabea9e431f |
Hashes for asgi_tools-0.61.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1151cd519bf49669cde39ae6ee62be717307c3a7b78795fd2338b11ae5cfe6b7 |
|
MD5 | be4f40ff2d0b849c341ba5e2c8ca256e |
|
BLAKE2b-256 | c66fd3c46a841d5ab00c153a7de5aec119ca478a84f9446058dda3ca5a9977cb |