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.7-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe941ce7f497c5b9e0dd53cb0601533291dfbc8278ea6937853da20018c31208 |
|
MD5 | 5b937cfef1da4e2f7a135741ee256c85 |
|
BLAKE2b-256 | f61e4b5d64bb3e32a48c83d2ea64035a9d60f6dfa5efca38ffb3117142ce1892 |
Hashes for asgi_tools-0.48.7-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08fb1ee9f9b48bc282d9cfc712474da5e77816327d24c334b24c0f13aedcdcbd |
|
MD5 | ca5d8312b94ac0c39b8bae51322ffdd9 |
|
BLAKE2b-256 | be4de979bbc0e9f6416f336aa2c938712f6f88a1bd2ad33251204ddecff2d5b9 |
Hashes for asgi_tools-0.48.7-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eb12a028268506197c04aa19fa72a8eee778a5b1a3e40cfde32e69bc3dee810 |
|
MD5 | 941ce08a1bbf1dc57be1a2566f6cdbab |
|
BLAKE2b-256 | 32c0d44889223d66e8aba4b70e78175b3599db8670aacafbc3bbc5749f0a4521 |
Hashes for asgi_tools-0.48.7-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e3cde149558b32f746b1a5fac4831b03ba39153fdf4d68f3ef285cada6dc401 |
|
MD5 | 694e2a57a043b330224828af127a163d |
|
BLAKE2b-256 | c61d5803d94d07488d2bf28b4c510139cd4f5bc3e9ff8c925510d2c9cdb550e2 |
Hashes for asgi_tools-0.48.7-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed7216429e054ace5c754a9df42fe31ddea337f61decb3a7a425b710c2aab2d1 |
|
MD5 | 25731f69923c966680deae2d92c49b0c |
|
BLAKE2b-256 | d6c5f3e387660e6424ba51580ee8ea0a0ec6a1bae59c1124950a84ff960bca50 |
Hashes for asgi_tools-0.48.7-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b40c20efde22a189829e37ec2c7a78a79401e123a202e82548cbaaba23d436de |
|
MD5 | e094ae7a89e13474cb5065f2004f0e57 |
|
BLAKE2b-256 | a6a3070a58547a6167f9c89329a99371855312bea0ace3dc66cb517c41548397 |
Hashes for asgi_tools-0.48.7-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5427f733b7c5725dbb3c47d6599a58b32a083757e84153e77f3a16b0d23468b3 |
|
MD5 | e3eb9fc86444855972f42d244b8222d6 |
|
BLAKE2b-256 | 27edeb90a7732d41eef86583ef9ff5dd44482ea47fd114f183a7a335928d2e4c |
Hashes for asgi_tools-0.48.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48c643daf05d53a869513c7ea91d775f83a654dede4b7eb2615c57e3181d856e |
|
MD5 | 3abc3826851d6e0df257709cb5d62c03 |
|
BLAKE2b-256 | 3dfe810f79f7bfbf253c23d3cc6e122dd4737f4a95725be30c4f257b27cc7a1c |
Hashes for asgi_tools-0.48.7-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf690f8dbc2c7bbda3f864ffbaa7ebf96ae35176aaf4f50cf995a05d548185f6 |
|
MD5 | 2468c9b15b844a3805344a9debbf6afc |
|
BLAKE2b-256 | 5c50a06bb3a48103d9f8d69a3328f0dfe74155cda199bbd26c2d8101bb95e458 |