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.57.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d910316f1a8ba8ac941e1b16a5956ae71bbf35ad595b4586cac2e907a1a74e52 |
|
MD5 | cf0aa388cac3e1b15e1aed77a94975b1 |
|
BLAKE2b-256 | 846a907cb3457c9d08439a462b10b7f14cae2d4863ad0718dbc69f918aa6a8f7 |
Hashes for asgi_tools-0.57.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 602f837deed56c9cce8e07061a61f55512c3a757ccbea9d8c6c78dd9d2c3c19d |
|
MD5 | 76a4b15310b8d65c8e6c335a7190ab98 |
|
BLAKE2b-256 | 19cd6c7a62fea716671dfa502e6b76cd451d2bac7c545a859d24d2c628950163 |
Hashes for asgi_tools-0.57.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33b8136cff6d7371d404fe326f7d8c5a37811b077108c62f94d913e24d5b536a |
|
MD5 | ffaf52e48ff86783a284cc4ad839f276 |
|
BLAKE2b-256 | 39fb9bdb2f18ad6248dac37f6da0d6b600e00c73ba4d8168eb62aad715023a73 |
Hashes for asgi_tools-0.57.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8680669a450b0affc968c432158f8cc03d7bc06f8b533133141b43eb976ca0f5 |
|
MD5 | b502d7ac64a030503075c1db99523ad4 |
|
BLAKE2b-256 | b76837663021dc7f9b76e26817f4c1408e83b740c6eabde4940594efaf9ef2ea |
Hashes for asgi_tools-0.57.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bda6e5cb0df84da08f1e3218a722e65f75693c70d18bfafb367b51b2865afffc |
|
MD5 | 7233330ac6ceeec368ecdcdfd4f3c330 |
|
BLAKE2b-256 | 9e8d5de86bc1e50e521d8576b85de508d14233bb72a5eb4b61e63c382e33538f |
Hashes for asgi_tools-0.57.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c87a617a1422b6f64a88dc4427ec52e4a7843737ad54a7fe985f2cb3231100e9 |
|
MD5 | 6ae0e0d1562ae7626cbc8c58856adb82 |
|
BLAKE2b-256 | da2978e4ec858ee5a34c41fb370f4046e0b2113a51f8329859725e5a7552d8cf |
Hashes for asgi_tools-0.57.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4ae700fac01262720ad2350cca91c42c692f5372778f1b603241f54cb4086c2 |
|
MD5 | d040b8f20a1ff443b56f0f14f16e4f93 |
|
BLAKE2b-256 | 96c71c74a05ec5139014031c624d2a4d26f59bd2828ee765f50a2c7cf79f4883 |
Hashes for asgi_tools-0.57.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58a064f9d5703f1bbdf65d0e9bd3bfb1c4f730d9fa2400e066e98f44e478e9ee |
|
MD5 | ae61d738817ff3ec403544a03014243f |
|
BLAKE2b-256 | 6c3035f7a13055a75ebff83ef1a7079e5b26e0b76988228d1a3b925091a58edd |
Hashes for asgi_tools-0.57.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb9f14be2519ee34d94bf411bc231e1a1f038b241a7223fb2d5fba72fb4e40db |
|
MD5 | 2345a1a9be6772c7cc76a7a8d352a92c |
|
BLAKE2b-256 | 122b6019f1b07afc2190c4ec1f3542028bf081f7547ffed1fb36ab58f51d9481 |