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.49.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f340331eabcbb9c803392cebf30c66e28b41f093f236c2d0b57d3657051a5599 |
|
MD5 | 4f87e1718acd4f6e7c4f58120a5affee |
|
BLAKE2b-256 | 1852a749ecce2ceafda12c043f7cf90344c8c0448bb727a68671b3048e6741d8 |
Hashes for asgi_tools-0.49.5-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6ffa6a88d1523de9e4d15ba3a2c7767f35d61a3688f067f295b119ddb0dddb6 |
|
MD5 | d70e6533f180deb066b97b93da7c2054 |
|
BLAKE2b-256 | 7cfaa92da63b13dcac8dadd902d3439b57d7c8328e5aef81b3fd838983c9943f |
Hashes for asgi_tools-0.49.5-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64f5cb0a2a45c91aa6de78110a379287f89229a2d96ba842d8110fad0da7cfc9 |
|
MD5 | f370a6170e3155321f6e9e0c8013518d |
|
BLAKE2b-256 | 1823cdfbfc3be34f5c2c0793ddbb09ad4b5b9f6685e8534f0e1b3ce3c6bd93e5 |
Hashes for asgi_tools-0.49.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae7399f8129e82a06cfcf4e807c1a7d99a1efcb96bfe6389cc1f1b925fc8a9ec |
|
MD5 | aa8e00ec51318e7f27ed4dd72ed5de75 |
|
BLAKE2b-256 | 3e2f5ebfd65985ca7a90e00d95c9d70a6ffb0dd09db102bc98c2a5714e09828d |
Hashes for asgi_tools-0.49.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afec16bf743f9dc4e52ebc5b7482a62851fc7b912bcaa3b3d46d3eeeeff07109 |
|
MD5 | f0286ec145462aab757e414b4e3bbcda |
|
BLAKE2b-256 | 957bcb5505dbdaf7680a085dd61dfc77fbd2ce1722df35633bb505fe5157d4f4 |
Hashes for asgi_tools-0.49.5-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6984ff90aec78908bd1bda4bf4fdc2281d6ee914c9019c744dc6759fcf1ed615 |
|
MD5 | 47ff8c93260c3484ca33ad37739f0854 |
|
BLAKE2b-256 | b4a7381d7a822e141f4a0241a17fb08d0005be2848da4426c3db598a2b3aaee3 |
Hashes for asgi_tools-0.49.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cccc97074b821ac8e1082d0dc1a2e50eab380275b0abb7935d4166d542ad1b6 |
|
MD5 | 79658f8a28c9c3cee1cf67931aa4b954 |
|
BLAKE2b-256 | 88b1110b271aaa96c1efb43aa1220d8eeb0d5e6eed428690342b3c543dc2863f |
Hashes for asgi_tools-0.49.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 417fb0cdde78c017a2244a4494645af151f93b06db26cc494338ef277d4c0b21 |
|
MD5 | d2726147a72208cea8a6308a84716021 |
|
BLAKE2b-256 | 642c7c3c32651af781cede1684b14a273f1cb1967c3a6ff94728e1f36dcec7c4 |
Hashes for asgi_tools-0.49.5-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46b2dbc03ea078b78f5dbb0972e2d8f107fe89cdda6030ffabea1d3d87028803 |
|
MD5 | 54666e9c6255d7872d16dd983143a7c9 |
|
BLAKE2b-256 | 2b9de89b3457dc3969ddfc1a7aa1e91de4d251d54a99ee345cdfe17470c7da90 |