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.55.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5eb8dd1a0686fa4b49faf40f1514a16a2d9eeb7961dea71eca65f711069a54c |
|
MD5 | 1329f98ce1db3b92ef6effc1617c804c |
|
BLAKE2b-256 | 99151c7470baf83507a9c96fc0a1e4cbe11eafd963a3b585767286650f9edb35 |
Hashes for asgi_tools-0.55.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b2d2057e1b2a9e80da73274fa5d2237c8f94595e5255d67e452ff7cc85f023d |
|
MD5 | a3dc615e0426a9039c35fca2e049cb3b |
|
BLAKE2b-256 | cf604c5014f0fb4900271ad70f9ae57af2566a304c1fa13da8c8f149249eacb8 |
Hashes for asgi_tools-0.55.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3b4d45ac1c6456af8d8d3d7a6d53a76a1f5606a3acf618a62007b7c1b27cf5c |
|
MD5 | eaae9be7e26beaf31fa58c54603f439e |
|
BLAKE2b-256 | 318a60ea893bffad975672386d8a6376931da33b6ea98aa57bd5ab6e0f8c03ec |
Hashes for asgi_tools-0.55.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3101ecf988a5e67c31cd140b85418668d1d480419a969b684327a0b4874c4a49 |
|
MD5 | 621e7cda09570963fb199d6948bcbc33 |
|
BLAKE2b-256 | 59712e4a0fdd41d022c29b0ad63a13e9b12981777238dd7cf9271267587dc65d |
Hashes for asgi_tools-0.55.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1553f5b9c51e9f3f0ec609b39a442f2af44f6e3b22b19e832f8d459a57eb408a |
|
MD5 | 4ed1c06b27efb3ebc3dedd57671c4ba1 |
|
BLAKE2b-256 | cbbc1cb6abe092cde917393d919484f3e73f79d0c60d9786bc40091783214330 |
Hashes for asgi_tools-0.55.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c174798ee06da97b21aa589111411528ec0f3406e64e057e44c56927789972c5 |
|
MD5 | 19ef0088d668644d38ce07f8854ccf4c |
|
BLAKE2b-256 | 8af3105f27dd4d41f282f778724bf1f0ed724245259bf8081e000db93b0e798d |
Hashes for asgi_tools-0.55.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41cca569c5638c9be469a20a662a4ddc7b27d241037eb6a9a7cd1da07db645f2 |
|
MD5 | 1cd53443ab4c85b034217a7cbc1c989c |
|
BLAKE2b-256 | 1d87f3fe9079849cd11bf14e433f75577bd4fefbec60979425d77b28373f08d9 |
Hashes for asgi_tools-0.55.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be6785ca4ac233c6b1d9c70141aa26de2799b5331f6492365ec4ed804b56f5ec |
|
MD5 | 91d5149ad70f0c1077e3faa5673bc9f9 |
|
BLAKE2b-256 | 908f942048133685fcec4fca471a253be3e5fd61fb547e7c4bc4316ebbfd07cb |
Hashes for asgi_tools-0.55.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0ac8d890da87145e3df70a1554377ce61d33f1a5fb9438961cbed92147db1e6 |
|
MD5 | 668b47c6999525a65a8041bd573f22d6 |
|
BLAKE2b-256 | 1411f5a888d81d404cd144fb3347399d234b2be9bbd68fd087c62e45412f48f1 |