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.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6b5d2272d169d68d706efcaace8551ac50d836fb2a3c7f704fe394a1350b58d |
|
MD5 | b92350ef6d96d467039cbf323d70c36e |
|
BLAKE2b-256 | 5f4f6f0f0535ccc3f2aba9e9a913a26edf0fac123b3b9f298389453817b454b9 |
Hashes for asgi_tools-0.50.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 080e432c87fb4ca4521b89361ab476ebd24e2c0a8bd7db49c0e3c1bde2fab0eb |
|
MD5 | 1f935c55761f9c86b5286f0201be5de4 |
|
BLAKE2b-256 | 4971929c566663fe06b957100e0d68b4aa83670bb1271aa1ae0f57b24ca5c932 |
Hashes for asgi_tools-0.50.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f2e86038c87de73879fee071a9696e7879e0821fa1c9eac3e1ac27d5e3ffe3 |
|
MD5 | e16cacb810ae001705c2a9de59b8ba93 |
|
BLAKE2b-256 | e5fa6d9307ed796e8bfe178e8588f3fda2a5b91baa2a9e438532830ffaef6495 |
Hashes for asgi_tools-0.50.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc830aa6734170fe0c215f7c3467eeb76b26d8d4a5299cb7732d059824a0ac06 |
|
MD5 | 5ff9570facf1bdf63614dfc12dd9ddd2 |
|
BLAKE2b-256 | be05cb2e36f4fce250c7147e50fa965250d7be742ffc6269fd53cd81fae6cb84 |
Hashes for asgi_tools-0.50.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c69e54bf3eac115742e52c28a87aba762785a673bbdcfa2ffd08bbe84a44c43b |
|
MD5 | 3710c8f9e3ca0c93bc49a06520b3151e |
|
BLAKE2b-256 | b584cdcfc4b7b7c8660add7e087772de6670b7631628309d2c6b7835fb65a2cc |
Hashes for asgi_tools-0.50.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e16f3d6bc826fec523701028cabd68070b23aeb2028b58bd322092529a8332b5 |
|
MD5 | ae0a67c1eb1b62e4870f79ea33a9c508 |
|
BLAKE2b-256 | 7a2620da4375a69a89d46da71929a1e857f78c4374b2b5dae9de0cb57d78d732 |
Hashes for asgi_tools-0.50.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | beb1a3b7e1121b36cea7ec0c0f726b0d8d9fe6cebd4f46f96abbae7fc41a69f5 |
|
MD5 | b1ea3aceb0fd4d67caeae994e62dcf88 |
|
BLAKE2b-256 | 9682c70d17c90e534ed19b9bb8c829c92a0da50d286470e40926ec779190a750 |
Hashes for asgi_tools-0.50.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46dcb0d2be4a3d09cccb6ee4f797ebdbd65e5c76154b8dec13d4432aec7480e1 |
|
MD5 | 266a5bdf923fb0d871553a1ed73b8da9 |
|
BLAKE2b-256 | f57c4a2a5ca58c7f6f8da79b1bd98be6d6ede1357cf8414688dae0fa0b975b3d |
Hashes for asgi_tools-0.50.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ede3159e8f8bca7e6776202741efb70dda4b6e319233a68f83d89059763cf6b |
|
MD5 | a7003a8a546d4c1b6c25ae3ff857195c |
|
BLAKE2b-256 | a228b66e90ef8c886cce47faf84be6341c070e8e219cad9fd5de8dcc348c3ca9 |