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.58.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1b2f0d2d7d19b3a8f44cad4af2ddaee0d74107e3aa3d268fdbeed5edc4bf8b5 |
|
MD5 | 90f16dde404de9509606039aaf95fc54 |
|
BLAKE2b-256 | 1a67f4492ef9c980d13db6cc6dbbc979a814bdb42c727f39e5cb4573436c7ea4 |
Hashes for asgi_tools-0.58.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 599676d734a296b1d94e059b57f8237f4201d6cbc4c76ee24e18031db82625bc |
|
MD5 | deca485a699e0a877b630d14bb3c52dc |
|
BLAKE2b-256 | db8b0e0fd7b7abfa19e86b96c012b12ef411fe2747ae2cd78a6f1f2798c48f3c |
Hashes for asgi_tools-0.58.3-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e0d8be1acd200495a3631a4fceeb2d522c84a02560a05cd675f1a9f12a0a951 |
|
MD5 | e15d21f6be858ebd1741c18a1bf1643d |
|
BLAKE2b-256 | 2200908c31d8aa870bdaf6723842c239bf54f8c55463d647d52e8056fbb8d2c4 |
Hashes for asgi_tools-0.58.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8e4e938dd9bf28daf929d3f6703beaabdfcfc99a76af6948787eb48151d3839 |
|
MD5 | 72af2434d59c328dea2a318d5315a2a1 |
|
BLAKE2b-256 | 72c405ab8e6a01486ebad2cb77948e29d4f4508d08169e6cf339a1f96cb48c50 |
Hashes for asgi_tools-0.58.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0ad2d7d80c7ce2c74928e051e8e31036a3b2c1518d5a30cb6c3e71cc20dcd15 |
|
MD5 | 77268ae7522ff382182076f068cf1e40 |
|
BLAKE2b-256 | 0cb490e8709ce18e3d0eb3baf68f32d4ab2f186e49069175efef32da990b10f1 |
Hashes for asgi_tools-0.58.3-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fc58b4d5419415b8be7faa0cfd0af0309c18d3e8d3716aef58b165e77a43fd4 |
|
MD5 | 4bccc5844d57d851e9adf056bfece8c3 |
|
BLAKE2b-256 | 112dcb03aad2c9c5468a18d60c5347a542c21260a13935f93d5f2a0c14085ddf |
Hashes for asgi_tools-0.58.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee5503441d761fd630c2f625ed86205843687bf3a295bbfb2a6f1697353e93a0 |
|
MD5 | 5474433fde02097452b034bd29c00cf2 |
|
BLAKE2b-256 | 89bdd500f4c62fc60759ce2b9e74c8e883e0677bdaa043bc6cea3c163c77de31 |
Hashes for asgi_tools-0.58.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5af96d8b12d6a031a2141702e5f7b2a08f93f86504f8a041c8cfb8d3052b04b0 |
|
MD5 | ad4d7317e4a5ebb1d1f3785e1bd66346 |
|
BLAKE2b-256 | d925986b1d8387da9bf1bf1fd4d014b4376fc2bcfae3c4756bde6afd65753c5e |
Hashes for asgi_tools-0.58.3-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2067f95b40e969c79ecf4462326c20ba207be0409328d6a3f3c9f62ccc50f9c7 |
|
MD5 | 87dd8e5dd8046640629c02997d1aba1a |
|
BLAKE2b-256 | 9ea15e0ce2459292d93a6f741684c30450a64f46d90b473276d1ec41c72238d9 |