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.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57733975716cc8143b3bd3e4d104a40bba35fa72e738714dd8348ee550b38465 |
|
MD5 | 1d1c5e57fea9cfecc79ed3d27bd020f9 |
|
BLAKE2b-256 | b67c882f4596a2df6b269a33de290544207e9aadae85880db8d2a5ac157d2960 |
Hashes for asgi_tools-0.48.5-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a693ec0eb1914e0b1c04e0d382b42549f1d92cea723b6ca92d7440dc1796c81 |
|
MD5 | cf8875cded6ac4848edd0e80fed2c170 |
|
BLAKE2b-256 | 6a2c8954ff26355c0996e5a4b1e9f94f2c69ed492e0f0e1f5156ab7a5c875034 |
Hashes for asgi_tools-0.48.5-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e8792bf562592558421fe5b973745c23428b977153d2ba0aca249d35caeaa09 |
|
MD5 | 8667626940b414abed96fb5fdb342489 |
|
BLAKE2b-256 | 515f3cbdfa3da63a5fb765aa01769f1ad8bd8f109268aeb0cf4400670b7b6142 |
Hashes for asgi_tools-0.48.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7308c29eb3eb9a5da7ee4159f9d2797e7de9f72410ff452148ddb9d36ff4fa79 |
|
MD5 | 4a17b8df24a05639b665640faebb1780 |
|
BLAKE2b-256 | da8345083625e390209cd44b72079da72026ba4dc9b9d58e4cea3310c8334e28 |
Hashes for asgi_tools-0.48.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf7383514054f3bf3ef91d6122d5ec519f28842a65b0af7510b538ec113e0303 |
|
MD5 | a006dd59920d4f13d9bbb515a631df1d |
|
BLAKE2b-256 | 1dff432a182251b497b63fed5af95fdd34121fcbe1133457162c8554694776f7 |
Hashes for asgi_tools-0.48.5-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22ddd613f54a3e3d6fbf032f93a53d5784ce6ad93f25562b11a18ba1eaba24f9 |
|
MD5 | ac2364be8285178b1a262627b094721f |
|
BLAKE2b-256 | 07587e6260b19d9198fd3005a74f4390abb7915e9c63738c1b48b71a3b78b83c |
Hashes for asgi_tools-0.48.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b349d3d036ec0d29bf4dc01b9646ebb106064e738fd3c92ce8251aea9d17cc3c |
|
MD5 | 039f8a6f8c0f8784efac570c07baf590 |
|
BLAKE2b-256 | 3c589ef90249fee4ac4cf2e89c928b4edea69894b32b78545b88c2af1e9b5697 |
Hashes for asgi_tools-0.48.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d56dfd25c4bba6be0982dc5296bec217348840935ed3e6ad2d16f7d5d3c6f7ea |
|
MD5 | d3f8815aabd6b68d2ed923cbf5c68b82 |
|
BLAKE2b-256 | 67fc43d05a16e098e759a003be1bd5b0ab02ce91e3e2c2225d0f1273cfa54d0d |
Hashes for asgi_tools-0.48.5-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc74ee395bb3dad4d23d50e2b83228dd89947936ed90c6b1f22221039982c152 |
|
MD5 | 4dd053bfa7b8f872b7cc76f638a05d1e |
|
BLAKE2b-256 | 17c94a5787b09cff6ed2b817968472d4db5bb3904a667f0a58c6a5fed3caa5bc |