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.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ba3cbc1855c9aabb8d22e968925e9b9f95f47d72768e27688de9c8a56014635 |
|
MD5 | 86f0b02e8010f6a929cb2ca28bfdb555 |
|
BLAKE2b-256 | 39b6768ed89ededdfe22afe936626be9da5e25b51128e4532b8cf4623f8f29ef |
Hashes for asgi_tools-0.55.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a03dace3a2a73b56a29913997b5a32967ad2a9a7d7995f515c30978d5717f65c |
|
MD5 | ee0c227983c1b0af3a39902973391975 |
|
BLAKE2b-256 | a2c8f9e65b8342adc23214347216a950a93713c6e7422e762bf388c6f3d0855c |
Hashes for asgi_tools-0.55.4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69f55e340cb20b06616f0442858843ffc9b83a621dbd2c753ff490cb00ec14b7 |
|
MD5 | 5b731e51442d59898f3e54d874dd2f23 |
|
BLAKE2b-256 | f3fe1c5a0c4ff587fbe20c49f2f6e8b1e1ae682b4308d7b8bfa63dd17e316832 |
Hashes for asgi_tools-0.55.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ec9c114fc089b6e81753f0aee33f75570aa7ffb9f0bb072facb012064f620bb |
|
MD5 | ae23c28f4030827a29d05fcb8fd1ed28 |
|
BLAKE2b-256 | 073934bb539c473773cc72f0c45b86de092ca2513f24cbce5ab914a41a493e05 |
Hashes for asgi_tools-0.55.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | def19bab5f3292401eb82ee145fdc0a97fcbf52d808bd761ed5bd762165d72f6 |
|
MD5 | ab0f1a2944614665718fb38de924f9e5 |
|
BLAKE2b-256 | 660aab0a33146ab15b1f92d71086de0161c38466c6897f94cd1f8df49cc3be9e |
Hashes for asgi_tools-0.55.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfddc60b61bd7a225a20e2bae34ecd814a562fb99712793292e92ce840d960c1 |
|
MD5 | c58ddb750b1696f0a976f1939f696e4a |
|
BLAKE2b-256 | 3f089654e49269c2aa3e426c715c2f03d7b13769efe7b89a3d9ec59c86f2a765 |
Hashes for asgi_tools-0.55.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da81063f5c2d80cb82e9611a80455da8341f9750f8d783bc583fa28da46d69ad |
|
MD5 | ad55651fcd244987cc37d548d9217d9b |
|
BLAKE2b-256 | 04aeefd347c94bcc580019709139aed69550fd855060e367bade0cc46d0e7e9b |
Hashes for asgi_tools-0.55.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95535ff8968f4c8b30141e87e43edff8b3808731e64a141905fdcc61d6570779 |
|
MD5 | d1d024210e1dc1accaa2241963c7f951 |
|
BLAKE2b-256 | 453d14f61888a833c01b51318787b012e6018fa1fdffa05f0c8ee072ebba933c |
Hashes for asgi_tools-0.55.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca89f5371ada6479d9747d92dd9f34fa34fcf1adf4f2010009878926e2aa66e7 |
|
MD5 | 9aea8c7a6529ae578a023a15d476f063 |
|
BLAKE2b-256 | 8cd864c28a603994d97f3634f253ae5acff468e09f2339fa4290e2ad3011a726 |