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.55.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aff9a31a66f9aa404bbdc83dca48a62a5e3f39bcc72d50b1758214351090de7 |
|
MD5 | 402b7d9bd5658d0ab9a0455ba55836cf |
|
BLAKE2b-256 | cd95b180e2f4289ea1c1ec27be0c4d6858d433752c9389588204e1a2eaf44c06 |
Hashes for asgi_tools-0.55.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8f9164bf88876d95bf1751b1777e5e081040662fb9906ae78702d8bdc6c3067 |
|
MD5 | a126e24bfad351b07640f1a036906a71 |
|
BLAKE2b-256 | 0e7ddc3bc44cc99adcdeb754821350dd52c1371b0d23b315bee86faaadd08fc2 |
Hashes for asgi_tools-0.55.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea7f0338a40a30d017f504721e5492b0f1e990b5aabbd6eea9c259f9442bb5a9 |
|
MD5 | 05f7e1a95d54742de51b05fce2005722 |
|
BLAKE2b-256 | e7b25d538c9b8fc358c54b20ddf92d63e98057f6a70a07da259972cd89cfaf2a |
Hashes for asgi_tools-0.55.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b3a1659483f683633adf168f917198f4fdc8caa7d80da0c9e147eb364684053 |
|
MD5 | f0bb5dc6409459b2da703dbb9e9dda5e |
|
BLAKE2b-256 | 45e020b20b66d85b6305aab29dfc531d8c722a3e271c51c2fd2cdb07fe26a6cc |
Hashes for asgi_tools-0.55.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 853b68819e08440d1aa4985928f0a610c41d9d0808ef179c69de5a1e959ba8cb |
|
MD5 | 081481af766112f4119de3115534eace |
|
BLAKE2b-256 | dd23ddbf8e61d955c68f4b1d454883a496e1152284712c637881dac9d3c7bd92 |
Hashes for asgi_tools-0.55.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae121f69053c76867ee7d7411c998840d24c80b284ffb5605cdea2d00d39f31e |
|
MD5 | 159609652bec1369491bb8956c55360c |
|
BLAKE2b-256 | 065f0cac2f4f2ed185772d4c28b41885a8e3c47e71c12ac591556a703fdf6ff9 |
Hashes for asgi_tools-0.55.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85878a619b1670cd4513ebbb2faf1ba15b55b1ab843e2cbfe1fb9389d766ac3f |
|
MD5 | 878d14a830858304fdf595b52f399599 |
|
BLAKE2b-256 | ff0b06b44a747a3c89b73ae814d5e4b81bb4e084f1f12537903924e21ae7f9c9 |
Hashes for asgi_tools-0.55.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82e359342e2a7641adbed2b5d702534259f56cc31d6a9cf56a4c71208ce47829 |
|
MD5 | 56be71de4d03274a4616a22e437eb3b0 |
|
BLAKE2b-256 | 3561f100321eca57675949df5d641a960e0593fc4722a67595d9aa3d80c01e22 |
Hashes for asgi_tools-0.55.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64673cbd68184816fa5b5571ee61623cfa96ca8b39945c8a6a14b0c808562ea9 |
|
MD5 | 2423d49beed93e8e51e34d24419282a5 |
|
BLAKE2b-256 | 93f9363e711b98cc53b8757ec7e10a45e07c390fc2dd8cb6ead60b51c21d58fb |