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.49.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f206e85718c99ce07d1a036001f92c5a5c0bc9bb20c3e5ee3ff935d6a407ad0d |
|
MD5 | cc6ee1b85ea2117c4e6ff7eb447eb6dc |
|
BLAKE2b-256 | cd05410281fe256cb00d0b48bdae2ded6a4d2c9784e59de9cd33116e59959733 |
Hashes for asgi_tools-0.49.6-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d67ee0cd633af370bc100409abb1c4839fec7f22d101aa2161e33b2e12cc445 |
|
MD5 | 7729cc8489620147ac088060c281773b |
|
BLAKE2b-256 | 830973fb123d35819eaf78843a82684f9e827021561b94fa7be51ac6e06bf7de |
Hashes for asgi_tools-0.49.6-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba2c0d60340b5b3825a3ff0394ccb9753031695a07928c564c907db5898647c4 |
|
MD5 | 4587931670b8ec820a8b1102545c62e6 |
|
BLAKE2b-256 | 439d7660dba48cb837865e559f7d2722ab1d88250fd4e0e7ab59ace1a17966b2 |
Hashes for asgi_tools-0.49.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d14db578f7d1d3e63fbe0c05dae5bec2c67798936024bc0a7a935ea0d021524 |
|
MD5 | 8bd8f8feea2107332ff94ff8aac98aa2 |
|
BLAKE2b-256 | 043f0c3e8c1fd28ae34bdbbd7779273a89cac64e231036071ca45cfe71864946 |
Hashes for asgi_tools-0.49.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfaacc177eb31423b0015fd861e37e06e9130d668d44071ed73a2f1607eea032 |
|
MD5 | fed789d7a14da0ca53e85796e24c056f |
|
BLAKE2b-256 | 719a7a45b2418e3733502f76e1187881fb6550cf0665c0e752277022d6c50bd4 |
Hashes for asgi_tools-0.49.6-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ad19e43e792fa76ace63da885cd5dff50412e6ab8d499fc714becbaf1d9dd02 |
|
MD5 | 4605448004f6eb275fd17568dea719ab |
|
BLAKE2b-256 | 99ef889640569e77767c96d3c5b092dbb3a517b98547f90a629aa8e9d7744e1f |
Hashes for asgi_tools-0.49.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cf544a372345b606ca2e6c2c049e277f7e90412aa8cd80b87167604a46f7fb7 |
|
MD5 | fee37417adcb3d6477048da3b3454109 |
|
BLAKE2b-256 | 209f647806a0750ec4b42140c0567c2610ca2e07a53ccaf9fc092ea7ff478100 |
Hashes for asgi_tools-0.49.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e20542eede7f65cdbc604b19b1bdcb7672fa3dc725249901e10f650900693af2 |
|
MD5 | 15b4a4381a88c788cbb622d8a94de0a2 |
|
BLAKE2b-256 | c6a516b64bc52c644a7f7565184e54144971fae0146c5efebb4cfe86d1322d7c |
Hashes for asgi_tools-0.49.6-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95c97ac7d11fb5075eb2675ca26983bc9e6d88117416367c17687fa1cfe89a25 |
|
MD5 | 4b63df446fbe5281c5d626176d1dcaaf |
|
BLAKE2b-256 | 77c68e4aef625975879370235690ab7e737511899464be603de774b62842f565 |