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.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86684f2896776d3e75ea9cca93b6d7375980345d5c177b1a574e10f75f561130 |
|
MD5 | 63bd39eebde7dab8bab158d4d3cc4083 |
|
BLAKE2b-256 | d455e61cb3c9a0291bebe1d5a71bb306a4c1e5eedbaacfab62fa8697b8f2715e |
Hashes for asgi_tools-0.61.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 355f97e2763029873f4c1c130fe159b2562cec79a5690a591f78d5191449256e |
|
MD5 | aa0ec02422badb5972a414c2fdae458c |
|
BLAKE2b-256 | 5021480e1aa9af7bb40dde3b4389d830fe906788405613d7a817cff8eb3e7366 |
Hashes for asgi_tools-0.61.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 758279b2b15cce3696a31f9f9540ca3f6f5e9db2aac1c1ee9d0a2884357098ad |
|
MD5 | 815da490d1b6e4310d19b6009520fd12 |
|
BLAKE2b-256 | 4c6dae4508a64042321ef1128fb2b84fa46cff8d79f3d93d1c3ec371776cf711 |
Hashes for asgi_tools-0.61.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32f89b8c68da177b4d92ae65bc8b3f04b32c757a3b164bda0b616e7b883f9eb4 |
|
MD5 | 8589b2e26a1731563212abf8504fc135 |
|
BLAKE2b-256 | 38368dd9ff0f37ddf6e5a05725c446c83801566cdb4e7ce8b313f4e729f4ab96 |
Hashes for asgi_tools-0.61.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25008118750a1b71174e78c872bbe3278058ff68c703cef32654eb2ce4cae50c |
|
MD5 | 244409631bd1e79f63e6f83fab248d15 |
|
BLAKE2b-256 | e3ba9cf496df7bbb314da8100f8ddfbb010f4d894dfda6b5683b34009a60f970 |
Hashes for asgi_tools-0.61.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80dd95015a689a3280a2ffde5ee585f266cda1d3e8be63da15b29da54743a7a6 |
|
MD5 | e351ba1485af83a5451f4e8fb76ed59a |
|
BLAKE2b-256 | a34b226399f77d2fd07c6fabec81da6f14d9bab9aa2ddf9a4256a8d9b121b863 |
Hashes for asgi_tools-0.61.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fa72c431af3001f557d8a7a98718cddae4a4fe46f95199bfb34339aa49d8020 |
|
MD5 | 9db9c5e7208145c61fecca989728a552 |
|
BLAKE2b-256 | 8fbd23b445783bbd22a204b802027f661c66f3b73c9d9e26b5edbf4a1d17d14c |
Hashes for asgi_tools-0.61.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f3f1f03ac947bb62dc91aded74b16cba37f0cf622d2e4bed20cdc6c03ed1289 |
|
MD5 | aa9dec901f908e393ef0043c1a66e24e |
|
BLAKE2b-256 | 7eb985d93af15145874f8a040e01532f4e19e8ea504156cd6ccc5eb5fc96a050 |
Hashes for asgi_tools-0.61.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b11e580fa601e2861c6d1783237a0e6ee4f458c02ca3a2c3f8aae5d6448bc271 |
|
MD5 | d7634f2fe8592b37c80e70beee1dd7ad |
|
BLAKE2b-256 | fc2eef2ddbae52de64f0edbdbd21b78dbd1e48c6cffa777312702b52ac3811c5 |