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.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94c0db2c31fde2059fb2b27e2934ffc24b72c5499a066980f8f0553fe72d5a88 |
|
MD5 | 9491fbaa2e65e2821f95796bac0c0e33 |
|
BLAKE2b-256 | b0800a164b579aef33b7741b2b266ca707d39e69fd2e713526f8b06218331237 |
Hashes for asgi_tools-0.61.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac8e7df9eb94573336ddbe5846c59937be54a76813e38ec01a255302908b3077 |
|
MD5 | 84bf783e7e9e0fd73f7d7f75168b1135 |
|
BLAKE2b-256 | bfffcfa5cca01efd68a71df1ac0967bf0f48545f8e0f4ee31a5fc683ad30148a |
Hashes for asgi_tools-0.61.4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a722ab319a390077c7bab6b9abca4e3350e4a33717372af39c0ffcd5b4a669a1 |
|
MD5 | e78adde60c26da560207c8baa8c31446 |
|
BLAKE2b-256 | 7ae97f27718994eea089ee6d713b13f7de0140614b232d6f71e44aa5a797baaf |
Hashes for asgi_tools-0.61.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51b9017ead32684c25b68a1b85ece790a1a37ea707211a1a12f5ebf27ad2b114 |
|
MD5 | 72a8a0eb04473bd4c4b185ed9f810114 |
|
BLAKE2b-256 | 8c25ce96053da29a64285fea77ff56b54a049a16a589528973df0c8c404844af |
Hashes for asgi_tools-0.61.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cca013b27939ced619d13216aa3c7116fc0d907d3c6a45d45813b9d58e74096d |
|
MD5 | 9e3add7a4c105617f856f0127614b6fd |
|
BLAKE2b-256 | 22494a32ecb4e9caafd50acc0b790f7f78e7f83f099b87064dadb8f7d14b1c0c |
Hashes for asgi_tools-0.61.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27bd3d02b5a790cc863fd8a72d7ea1c26570473391fd146577e6b90bbc568588 |
|
MD5 | 2413a2b8bf28e259c0e5fe2e60ffced2 |
|
BLAKE2b-256 | f3c39be706206d64d945e5d0313b2579d1def1ef4057bf255b7f840de94cc227 |
Hashes for asgi_tools-0.61.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86700cdc1985cc462635617d06fabb4ee7274c5c20afd11cde54e1fb9e8d8390 |
|
MD5 | 75f5fb773e025afeef1fa471d8c8860a |
|
BLAKE2b-256 | eeafa593c0632e421d4d7a545ad19765ef4f215abf88c33f2bd94c0c21a0cedc |
Hashes for asgi_tools-0.61.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bab6413ec4e398216d8f6937c236ca4dc07f01c6a15d2f745f2f4516eade5aa3 |
|
MD5 | 0190e522c1de494a1af24da37f22a0ff |
|
BLAKE2b-256 | 8aedc63d8e1f2c8fb0cc09b83d3bc9c61a74ee6105f780207668857b2677632e |
Hashes for asgi_tools-0.61.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a0150e2837c9fa16452f2907869f50075163fc0c3987e14b53a1ca7238956c1 |
|
MD5 | d6b0f5a5616d9827b853afceff851263 |
|
BLAKE2b-256 | 93fff73d1f1a58dd787045d4757f734fab39105be33ee17240ac52dac6f3b6e4 |