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.48.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f8528230604fc487ee270197763e010352be8f4b22bc8cfdd4e791870d48ccb |
|
MD5 | 8e5c74b91ee0f14443838954bb55e265 |
|
BLAKE2b-256 | 8f0e1a7fc85bb216ee996b1127565119d9b851bf7fa3f29526b04dc97bc0740f |
Hashes for asgi_tools-0.48.4-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f81ee79bf6131f644dd6004bfb177a4cdb02fec4ed5378858b72c47c465031b2 |
|
MD5 | b7ecf2cd0c86a0c81dc6328f489b86a3 |
|
BLAKE2b-256 | 51d0147a91e5b48efa128ce4e7c52441587e25ccbe47c13f110112ad6757bae1 |
Hashes for asgi_tools-0.48.4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 090d16b157ddf058673e26a931f67369c6087084468e1ce718ab05cf4d0703b1 |
|
MD5 | 9a32a66c883785aafadc6243f096e2c9 |
|
BLAKE2b-256 | c3d8f2336fce95b94cae897560be8635151694f2fa7f948238debea308ee7647 |
Hashes for asgi_tools-0.48.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868d4a24ee58c776e4141214c4581d67a3e5fb4c080a6215459027e89536a7f6 |
|
MD5 | 5dc94a064e938db57635f00b8c30082e |
|
BLAKE2b-256 | 2008eeb83a48dc0d4348aa53de987a68e9a63f20a2485900b9c99d40c4656524 |
Hashes for asgi_tools-0.48.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7567d13bae4eda2f5b859cd46dde9ba0a4eacf081bb092690db9ab8c0d91e68d |
|
MD5 | ff66b4ae3d0cca73157d5c3c3c0e9f94 |
|
BLAKE2b-256 | 55b2027068bf084410708561bcf5b13ca34d90fe97c9af2f9ebf9268dd2e2d3f |
Hashes for asgi_tools-0.48.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7989e81aa2c5eb283da0b7409ce2af2da3d715ebd0c39670043159927f49241a |
|
MD5 | 558f5ce2cca6fe5c688761cfe33b118e |
|
BLAKE2b-256 | e43e5ce5d1837e0722092d419b51351e5a9ce3490ac1baeb90df6998b2461e02 |
Hashes for asgi_tools-0.48.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42f65493702533a4cd1a12beebb157b30d107fdda4860124b90a24b9557f69eb |
|
MD5 | 4ef35d73fcfc30fb3dafc9272aeaccda |
|
BLAKE2b-256 | 522003cf4656ca9918c94f2cb9fe4187fb8d68225db03d25bebbd7d95819c1fe |
Hashes for asgi_tools-0.48.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c41b5058faaa82a266bdb348ef7eb803e85030e85c4ca000a1a9dd1c56f17a3 |
|
MD5 | 5d500ac427507ba319b4e70abbeb2510 |
|
BLAKE2b-256 | 36ac8f5dc39455093c2eeffe092554ae26ae396a8b248c75ec9fd7330b80b9ec |
Hashes for asgi_tools-0.48.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c28b2af38de1fe960f5361b69888b14f943320b2a6ff8821e6858ebbf2822a7 |
|
MD5 | e8c035ee989c1385aa172b988f4e1a79 |
|
BLAKE2b-256 | 998cde58881367ac328e606438ad811d25c2dfbb53643828b034c813ffb297f3 |