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.50.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e19dc3ae495408eb6495fc95dea6ec81533d3e5b0e8fef537ce4f6f055f5b9d |
|
MD5 | bf44fa760d14d9dc128f429e163d5559 |
|
BLAKE2b-256 | 35a684c16dee03255287751802ce9dfce08d66a135b98b2ce08e21f48280edbb |
Hashes for asgi_tools-0.50.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a07f430b9699bb0e06d632e1a3514983ae2a9e0ba7c439ea7084032a0eecf06b |
|
MD5 | 6ce00e5beebaf444bb4f21ca462e7171 |
|
BLAKE2b-256 | efab15d95fd28d80e43a34ef506488510c3bc854f8fccdf7bc64d50bfb780ba6 |
Hashes for asgi_tools-0.50.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82a80ee184089041f9c0840b29e24a4c091b889d7e8e17579667ff70bb9742ad |
|
MD5 | d865ff680b3491a28abff7fad9276773 |
|
BLAKE2b-256 | 62ba7176b8e9fa35abc25a76ed246f402fcb655ac9cfdd1a4776a9553f748471 |
Hashes for asgi_tools-0.50.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a84768fbe25ada9a1640ec0e972abe2d8b90e08e919627833072bf29529f9b2e |
|
MD5 | 63ff7680fd0c4298e25fb865a7775bcb |
|
BLAKE2b-256 | 5a0314c74a124d09b574e91b83232c03441086794599074cd468715ad5378897 |
Hashes for asgi_tools-0.50.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eec91f7f0264f47da48a3bcf373b5f37f8a51f121695d1ec841573d586556b6 |
|
MD5 | ceafe72c701f5a44030db97888625e6a |
|
BLAKE2b-256 | 260e3442c2600b6821e7769f934226c4d685799785512d3482cb6a40567a117b |
Hashes for asgi_tools-0.50.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8e158e23e32f2a1f523cb4fb3c137e8216614577a5e6f3da292ab59714995c1 |
|
MD5 | a1947d0fb35f5068b25b31004081b87b |
|
BLAKE2b-256 | c560a645a50ad90323f03e6ad9a06a0c9a1f3fe0348aeeb6141af3c047ef8f94 |
Hashes for asgi_tools-0.50.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e49e695436699f2cce68e91b6d6f77613c5cdbe3e2476612883929ed3b13e77 |
|
MD5 | 11f061fa8f56387189c6a75ec4e9b0ca |
|
BLAKE2b-256 | 6852d4264a297d49bac77e59dbdecbb663effb675e44a3a6cbfc1216b69c4782 |
Hashes for asgi_tools-0.50.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6689a05f206534f9297c382436f5e5028407925ed0b63286574e1b34e9de96d |
|
MD5 | 6be053045b3db4ba8f84b701db874a1a |
|
BLAKE2b-256 | a16bf7e033d618950ad3e85a08549bb72353a080deb74f8dc9d435d4fbe91267 |
Hashes for asgi_tools-0.50.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db383aa5dacd6f71d09382c597a9e27014f10eb7e9e6942a6f9e5c6c5a019ddb |
|
MD5 | 634ae61575fbf89c5355ed914c838657 |
|
BLAKE2b-256 | a1df97284658e0b97e0887545becaf9b4128a14f9a9c7e83140e963939326f62 |