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.60.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d107ef96af2d15308acb08da8ac49231291002f236429120a339797b4da8f84e |
|
MD5 | 45058161c5ba356825c7eaeaf3dcd753 |
|
BLAKE2b-256 | 70c28654af68bb8e285f0580f1af190f055720b13c9c3ef5ad3f5c5240299639 |
Hashes for asgi_tools-0.60.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c325e6624e2625484508b41f9a3850e11d0dc6f8fca2ede565987edc9f4fe64d |
|
MD5 | e22b6e4d7140f76781d3d6b022d5a327 |
|
BLAKE2b-256 | 44e33b66a7f553b402925ea8eacb136821e3d5c253695fe54c4d57c4f64257f3 |
Hashes for asgi_tools-0.60.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33ab5fee835fed5418674c590a73e083864007888174d54954cdb5759b680b78 |
|
MD5 | 8fa5da3d82e342cc3a45c14c78f623bf |
|
BLAKE2b-256 | 0847e55889050d01cb4c08c18b8b01867cc4a323814f81b15d96b6c18de589d7 |
Hashes for asgi_tools-0.60.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdbeb0e9d4c09ec46fbea01dc58f23e86145498a92a782e283040d77a49f2a16 |
|
MD5 | 5d2c04548e3298e85db7d88eb245c632 |
|
BLAKE2b-256 | 75a68dc38d963149eb6e3bb1b6706f61838313efb1e40454ac63e0b299fb25c0 |
Hashes for asgi_tools-0.60.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fa69fe227a9cad32908192e289dd66463a93c807e79b1b661f3e2ff5e47272d |
|
MD5 | 117e60e491c90c7a85d9d8fbea1031cd |
|
BLAKE2b-256 | 5541cd78bd656a1b235f2eb51f3007716a233ce229a96498c0efa45141cc6f81 |
Hashes for asgi_tools-0.60.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 694b405e6613f218e04bd918e8d681c8923c3647d6c530da9e933eb0d0c6e25c |
|
MD5 | 6a2f69d06f90924d35f76416d6352a92 |
|
BLAKE2b-256 | b0b9e3fbf7f51b693699c7c8c50ce8286d6fa5d29f2c9f5d8c99388e654d97a5 |
Hashes for asgi_tools-0.60.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 860ee780642bf86a7ce7b0888176f727cb594076a4f67ad46e220818110922eb |
|
MD5 | 113f9ec46ae5e0323d1cd44da5828e85 |
|
BLAKE2b-256 | 2df9fd0043adf5cfde3b3ad6002a92329565c47047500bce2991774104771224 |
Hashes for asgi_tools-0.60.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d7828465d5824eee78a1851bf2ccbc55b927e37488aa3b281b7ff654551e83e |
|
MD5 | ba8220374354f2d86b42ab4b00aef7a0 |
|
BLAKE2b-256 | c48fdf20449418c4a7fd2243f157ef582faec5a0bb3bb6b58f106198e22d83c4 |
Hashes for asgi_tools-0.60.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75d805a8129eb0c8866e277bb7c27ca05d6556bd9c139b4de70b96ef682dad45 |
|
MD5 | 414e84c55534776d68f07b5196bb0ad4 |
|
BLAKE2b-256 | d018a39c3405f4fc4f21e1acf1c4da41f73b38c8648c7c17d8052630804cfa1f |