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.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd8972b1b513863bff5ffec0ae6c220fc94bcf8fee081b071899a9917a7a2f21 |
|
MD5 | 9033004e733f0d7126036d75fa7816d7 |
|
BLAKE2b-256 | e003c41f48c55d5824b7ab7706fab5d512a9cb819e6c10b6d8068842f04d1425 |
Hashes for asgi_tools-0.55.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bebf5d47436807ac2c2356ead7d026bb3cc5cdd000b91618da31016526a041b |
|
MD5 | 6f3fcafddd9eecbe4c461defab0c45bc |
|
BLAKE2b-256 | e0d7902a094cacbd7d0a8e371e53c7e2841169bf47ded2651aac2d5703303079 |
Hashes for asgi_tools-0.55.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9886b8c80eb3df9a0fd1871ed0c25581d845baeb37bbfab03ad21509073a7bcf |
|
MD5 | 42fce822000107c8dc5372b70dab9600 |
|
BLAKE2b-256 | 5bdfeaad85bd01ca6ec2bb84e055de05a9dec0d785f0693a6701aff1211b97be |
Hashes for asgi_tools-0.55.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e994e5c99b53a84af33cf85484ff85a59c78cd2456feb95b2cf493c32d644885 |
|
MD5 | f6b845fec2dd03469c0232a87e6519f5 |
|
BLAKE2b-256 | 48301823e32f7325d53d5ab5c2070784af30d007bd508cc97f8bcb003a462a16 |
Hashes for asgi_tools-0.55.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 669a0b8881bd664555123b9e4fef45dbcc5a8f5bff78a0c17f1012b449504f0b |
|
MD5 | 917260f7799613365e303ea4ac64469a |
|
BLAKE2b-256 | d09cb9518e23c0f3af1154a20ddf430f9a11c23c00951ab05e8bec67776d569f |
Hashes for asgi_tools-0.55.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41acf66dc13a1c3c27a551dfc303bb0a2e7b28a47095c228a96b4e16d0f69ec0 |
|
MD5 | 7697dbd16d07df237ad22b9967d6f85f |
|
BLAKE2b-256 | 9f32c9a0a45b1bf0f25243938f7023b7a6aa33caa5e35dc6701cabf804a15888 |
Hashes for asgi_tools-0.55.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8aeb2a18721a382ac872fe5912d467eefbe8232e0949a11d8abf362d9324aff |
|
MD5 | 83245ae124437620febf0fc8778eb71a |
|
BLAKE2b-256 | 04cc39ac70ade2c800a1258fbb2e941c97ad84414c9d32df3102abe74e97bceb |
Hashes for asgi_tools-0.55.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57a7d914d8f22740e02c439067dcd78450930312cfa2ffa49fc67e8ce842e5bd |
|
MD5 | 0332dabca65d18b2f641df160e324bd2 |
|
BLAKE2b-256 | 08f06977a0bc00ff477ad0288f3dfd92526c0f2562919674365ffc21e2221ae9 |
Hashes for asgi_tools-0.55.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9894cfdda84e3ccfbc0b49ad5128f126ebb7c24c8384a914ed0fcf8c8cbe7052 |
|
MD5 | 671cf3d56dde464183f520fb874b7782 |
|
BLAKE2b-256 | 0623d67cc3852bb700bf15924b239828ff50ff7f085b89737a76e28905eb81a5 |