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.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d82f671481d6ca8918df4882778815567673f4d6d4f156da65b1298dadd68f7b |
|
MD5 | c2f0c43fbe17fb3058348d672b015e50 |
|
BLAKE2b-256 | 2a64881b73402b45069254f941ec1108fa9a27fa87022ff581f967ba869de661 |
Hashes for asgi_tools-0.48.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10c1916c9e48473c531bece11a803082eb253fc557b2c0d6d4ad983a2a64358f |
|
MD5 | b29f6e930f08f0c3d145f208e6380672 |
|
BLAKE2b-256 | 53500f31b758b15e7b74d811cf881299e26a1680574abd9f75341002c3a724e9 |
Hashes for asgi_tools-0.48.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b98d314876d13b704db0b8a845486edc1104dc4fbecc804c0b97473c04033a9 |
|
MD5 | c534660285522254c4ebac1156794461 |
|
BLAKE2b-256 | 4aef108330618f9f37ce636e16c7bf4f702b79e23555753367aab778e581e2df |
Hashes for asgi_tools-0.48.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60c3bb974e4d9dce6454892e43c953e16979e1041e4996754ed0ade0a0d8e6c0 |
|
MD5 | e6bed9cdb63773b960070505a063d000 |
|
BLAKE2b-256 | 80db69b55f0be136dcc0e231345bd3281af5f7e559fdcbedb1d9b53dc74bfc5e |
Hashes for asgi_tools-0.48.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc6c8a5978338303b7820b671c02c09ff8946b893fb2013bb2bfc5b820f4f043 |
|
MD5 | e11ec7bd24a51fb35947b9d7834f34d5 |
|
BLAKE2b-256 | d7749379e59f535dd7e0da94208e2f5460b73f60aba9c04b394bc9fddcd840f0 |
Hashes for asgi_tools-0.48.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a101fd18c4115768029b9111d1c23391e1c0ac4bb851c862e28114fdc47ac89 |
|
MD5 | 3484bb04f5509d642b7773ae14c55827 |
|
BLAKE2b-256 | 72d543f97323dbc5441c0fda529c5dde305ca1fb8aec3e3e972c3bad27156d94 |