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.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89ce46e1f930854dd25da233d16f7a7ffee9dcec3e871036737f3b94f4e0db28 |
|
MD5 | 56b6baecfae3d29d49ae4309bbc16433 |
|
BLAKE2b-256 | 78f23c3d79ab10cf4201ace396431ed40bd9465a39c7422afe5cdd5971550d71 |
Hashes for asgi_tools-0.61.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c7902c893b72414655b23c3ea6ed57a3c0181f4b40fc9dc883efa287fc78c36 |
|
MD5 | 0a0af246327c990115af5a5240dabeaf |
|
BLAKE2b-256 | 181e6d2116e05eec04e1c28db8e7f06587995fff85b63e9060179e9249687dca |
Hashes for asgi_tools-0.61.5-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7561f47d697444d7d7b0444a69558fbd09924e221ea8065611090bd9e0bdcd9 |
|
MD5 | f3e58ed245198a8fb9d8a2a7d95b1733 |
|
BLAKE2b-256 | 02feda3f0bc2c90bcd7489e2c1f9e99e14834e0f5f46de94891da7d935e8e9ec |
Hashes for asgi_tools-0.61.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef12fb960b3f3ca98a786d752b82a4fe64ff48ad995b6fd7ab3d81b39eefb3fe |
|
MD5 | 62eef8e0de72aaf34788f5429a66e462 |
|
BLAKE2b-256 | 490d310bbd692105268c72c4218137722b5a10d57c1de722c5a65564e05e7d97 |
Hashes for asgi_tools-0.61.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8360bfb62c66218b682f2635feb9a2da7617a326a1aa6bfe1664deb415d9c25e |
|
MD5 | 4034dabd0e05ee66a209b3d883e66c53 |
|
BLAKE2b-256 | 41d9d0d6cd2d88162b97996a504df96404ef9374abb4797adcca4bff3c18793d |
Hashes for asgi_tools-0.61.5-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a24dd924ab2bd8fa8f644dabdcdc689fa0f3c112f925161a9e82eb746e81f0d |
|
MD5 | 1c9c96ee15060fd686d0d14884577593 |
|
BLAKE2b-256 | 97d8fe4f8d243617a7001172b7dd2be0e97234f04754218c5ae1dbd344f506cb |
Hashes for asgi_tools-0.61.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a8b0e8ed36860c69c488046bddd4f8cd273904bded1fa4d6a2c1f046438dfce |
|
MD5 | e6240b0b4344d7981e64d957e4e14d0a |
|
BLAKE2b-256 | 9161d7e5ca03a01d5f2927f299a7ecc6880429ae344c8bd64bd662451b828384 |
Hashes for asgi_tools-0.61.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e64d56f6961809cd5f931bd779860c5ee0c86ae85f3f5f8ff5e162e713915b3e |
|
MD5 | 293bef10c73118bfacdec55c8efb73da |
|
BLAKE2b-256 | 193d87e68e46c1d0c5e1969d2338719e2dd279a3d7eefcace90af4bdecb33ff5 |
Hashes for asgi_tools-0.61.5-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16ac4015c5ba36c5ed39921839140ca57f51d264986bfa2eaf1d7517b7ad844a |
|
MD5 | a9baae5e02ef777a5577e1d570a17961 |
|
BLAKE2b-256 | 82f00cdf5f25ebabd31131c6c0bb74e3afc5da391adad1ccf819e46f1fb0dcf3 |