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.52.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5186802cb34004fd43d250b9d4ef6d34333a716cafbab06e6a53e798719957a |
|
MD5 | d57f5cab1b50854389878f541300feb5 |
|
BLAKE2b-256 | 22ddfd0f9c41da7df82d40c047745fe924d79b8cb7420ff2ffba6ae7f50eb6ef |
Hashes for asgi_tools-0.52.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3b11a02ee036548a4ee64e8178812acbb7ebdc7bcf6ddeabf0e3641b1082842 |
|
MD5 | efdbc3558c9c642bb9708688879f9754 |
|
BLAKE2b-256 | c9b5e814f45d3209f56bf521653cfc3cf98fe14b03cc87f6c747b7ffe7729b7f |
Hashes for asgi_tools-0.52.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26cbc8ef8ea52698fd7fc07adcf6d48a1681c47437292858f0e953dc3d4d0d74 |
|
MD5 | 68f46c33564a3cb76de6e1a1b3dbbea9 |
|
BLAKE2b-256 | 7556ac4959d4c8108db397e1974edbf8cf6bab13ba595b07e8533171bd874636 |
Hashes for asgi_tools-0.52.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e76c6481b3011f76ae05ed8b91f905a85c8f16592dc0a21de470dab6e70a986 |
|
MD5 | 49c07e46cc2330e36c2464ae5d09f313 |
|
BLAKE2b-256 | 485b0f1c460b125bc854c1eff1676ea689bf1f4331ea6015a9928f6a2e618a68 |
Hashes for asgi_tools-0.52.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a51bd16f78afdb4358bde96e1e2e39c423dd4549a0d643ff59345d819d2f9352 |
|
MD5 | 31c534f42fb58ac3cfbbd797f38eb437 |
|
BLAKE2b-256 | 9dc31bfdf7b26dab64fbf2305220138bb12cbc295d35a54d94fdc5a89375e385 |
Hashes for asgi_tools-0.52.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d09e2ec0144fa3f215fd54dd580109e739319414075ec6538ad829ab6be6db03 |
|
MD5 | fe2c06379cff82ea5dd15745d1d1804e |
|
BLAKE2b-256 | ce5fa87d96e0dd373578e6e388078c2d8504714e402e969e333b3854fff8eab3 |
Hashes for asgi_tools-0.52.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63fc9db0a0addf324fbf939f019b7319abd6d2a809c1e3dfee2c8d685fef74c7 |
|
MD5 | fb579baf5d242d7e7956b5b9db728e7b |
|
BLAKE2b-256 | c186164b9337b5d3a6e187666277c3c739c5966ed360f0030b89db741b06d40c |
Hashes for asgi_tools-0.52.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ef9d5e0d18780cc68eb589301fac5ad06ca85d9d648049aba2d6f2051e505d2 |
|
MD5 | b0873de77e3b2adaa6ff18818e49db3b |
|
BLAKE2b-256 | 0ae35297ee1b549b58e8e66789b6a12ba1228bb20d29fc27c765e679e02f5f2e |
Hashes for asgi_tools-0.52.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 853ffe3baebd8ede7516d28f38ecc8cfba1284e2505e12e8cdd08e3156bbe39e |
|
MD5 | c652aef2aec38accf6afe85cb8763575 |
|
BLAKE2b-256 | fdb72a3c63f82890cd2af7b2c89c887be99bdcf69029db9f5fe922ad2f480c22 |