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.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f034ba0af27bd64650b849be206d74ec0ca6678a825d5982dfb706a6179d3d4 |
|
MD5 | 491709bf073f51989baf2f5c6473d972 |
|
BLAKE2b-256 | fb0d475c2f815b78743a12306d456421182d13848827610f1d13274ff4dc1e1b |
Hashes for asgi_tools-0.48.6-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d4a0977b1a2baa56cba60b97e4db20e4c838ed46bf490576a7752c3a4ec98a7 |
|
MD5 | 232bea8e55018fe6ffee00aa40e96644 |
|
BLAKE2b-256 | 326e0c1e25324694814aad605572df46d65c8246bdd45919f380e2f3a86cb986 |
Hashes for asgi_tools-0.48.6-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47a3e6f555108ad8ac7b923620a5cd726ff90189039a7ccdca215c763bb5692c |
|
MD5 | 2dd3cd5f23d7ce448ef280f9f5eb25a2 |
|
BLAKE2b-256 | ef9bfe54a8a03fd11677e7406f2fc2d019885adf7aec68fdc3d1013b9577a610 |
Hashes for asgi_tools-0.48.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3289d6213bf9f71e0f961a0a1857630a15cd1682c49a547bccf66748d9e13f32 |
|
MD5 | dcd03de1a351ce149c8d37e4208a22ee |
|
BLAKE2b-256 | 22e772fd949501bea3c81927cd418a77bb7e469b448c887f27d55d129142ac52 |
Hashes for asgi_tools-0.48.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d75c77d39a94b47d6891c4050f4a9e3a1e892eaee623ae4f511db2680afac63 |
|
MD5 | 77ec833707d8334db4696783527ea1b8 |
|
BLAKE2b-256 | 36fe5d4f0fea7b11a0aaf23e6f4989ac88fcb5b5a6826d6b68342cb7e1432b35 |
Hashes for asgi_tools-0.48.6-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aaf3b1b131e2142dff36fe5c4d00baf233354a0973921bc03c06af11af7ab40 |
|
MD5 | 4d63e17bc31614091a8db870e090024e |
|
BLAKE2b-256 | 7238592d2a1f772ee67e1ff99e58e257e4dbdad5e4e6fbaacfe1352211dcea88 |
Hashes for asgi_tools-0.48.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80d205dc3a039839d0e2187117dbc019f7ce9039fb2f2bfbcaab3c7b3ae7801a |
|
MD5 | 51abc3530ac8a405221754acc48baf04 |
|
BLAKE2b-256 | 9bfa3fdef5bbabd63e231dd887b413b654ee2399ee737f08cdbed83508291205 |
Hashes for asgi_tools-0.48.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e26cc925e47c2aa241240e620c487e93f668107f8f29d70427c57f681a45c475 |
|
MD5 | f740d2fc864b1e326a04b030f794208e |
|
BLAKE2b-256 | d94747e5fa37e7bbc3d09b7fa6ab2721e23f261624d7eb40caec5d396c2f58e7 |
Hashes for asgi_tools-0.48.6-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a8fab1ef977426459a2b19d98341fb4892ccc7cd4c43edd5175d48b3336ac2b |
|
MD5 | a3cb4e6ab9cf2b029b769da06c564eb2 |
|
BLAKE2b-256 | fb5153c755bbcbec34a0bf264a73594730678d308bc4e2cbab3f27702b5ce1b4 |