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.54.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccb6f34908e80418101522df578e3181c04fb924314c0eef1fc150aae0f4554a |
|
MD5 | f60e8c5715bd759cd9ed7ca197aaff61 |
|
BLAKE2b-256 | 7db6a9276c92fb21df061a9c66d61853934500cb2556527545c1e158d9b28982 |
Hashes for asgi_tools-0.54.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b105b4b58a03e36bd43929d8b2db637d8e40dbae2d664003a80e37b98506b02 |
|
MD5 | 84eedca6f068d4402ee4c5d2fdf722aa |
|
BLAKE2b-256 | 4f3224b0b40063d8d941c7fd0afb1d61677b83d7927c19bf2b423c16ef760949 |
Hashes for asgi_tools-0.54.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5252827d602ffea94ce3f002836655324f03dc15cca3affd6187946240834ce |
|
MD5 | 60678408557f3cdc7f690fe4f0c80571 |
|
BLAKE2b-256 | 2db5f1f6d7ba877f774f76ae789d10ba7089559bb978f4d5f1a1bdd141ad04c8 |
Hashes for asgi_tools-0.54.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76066c07e8bf47464d4d3f9c35e624a0dc8b6634c0cb195d1f1c425fd7603ffa |
|
MD5 | 3a9197a9e44b9fd29a4a360e49428bad |
|
BLAKE2b-256 | 5e7e9b19d2a5fc6b90ea4720c7d56d80b86dffd6d9f2bc4c46ecc41ac6ed15b4 |
Hashes for asgi_tools-0.54.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0035af89112d1d536769cb0410f7d6b41fc7077cc820d1120d95f3c11438383a |
|
MD5 | d8e8cb27aeb2de6aa5ec29a3e404541c |
|
BLAKE2b-256 | e74dc8690b26d38d61d14953ea77388c7f38ede910bdf1b29511da41e568e63d |
Hashes for asgi_tools-0.54.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29cc967fe338952d0dbea9628424ca3c6c08563e7272403dd1830f93221157b5 |
|
MD5 | 3294b8cbd35efa0a41e99258eb9fac3d |
|
BLAKE2b-256 | e7464f416e1c533f49246613195528c78121aea5d31cc3594fd5bcf3e02ae5dd |
Hashes for asgi_tools-0.54.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90acddb20777796cb04fbb763eb757808cfeb37accc6bf710bb91e2fc1e64bdb |
|
MD5 | b0fbe496c5bdfb3b2df2c47c98c73bd6 |
|
BLAKE2b-256 | 57ab29917bfc02b5e3cd031320c56dff95892b14a50d4f469fe4038aada8fda8 |
Hashes for asgi_tools-0.54.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a05f9b2aa5112abd5b83c27e90c8682ef267df0d1abfc54b1015fae034afe79 |
|
MD5 | 8913fed7ee2bdfa2fa4aba659e8fe599 |
|
BLAKE2b-256 | cfeecd926b2dafd72a3372f6b730ba01ca5625c4cda667b669bd8419b2aa975a |
Hashes for asgi_tools-0.54.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99db43c378cea3aaf9b461fce64a443a3009fcce59a4f621635b6c3bda03fe15 |
|
MD5 | af5fe25478a63850964a7052bb9c26ad |
|
BLAKE2b-256 | e487b4229a1d4acbc6c4faae4f2d39e65dad383828d728f38187c7324d0e9a06 |