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.50.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 800c783db289f9a0c49ec3ae5cc056a9d9a3157e3e002f6843765284d16ed959 |
|
MD5 | 276de3c86d1cfd36399d61639b843226 |
|
BLAKE2b-256 | 6abb28e53da9297d7ab75f4f84abe8bca43a8aff77b9c402d2014ca2946a811b |
Hashes for asgi_tools-0.50.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9e18bc25e4f546d6ad9ddceae7db5c68c116110100eebcb9594958d5174ebde |
|
MD5 | fd3556163779cfeed8d87c0ec0eeb590 |
|
BLAKE2b-256 | 4bbb446f6e286abaeab379002026f714f169e60ea5b3dec3e69c1c635cbf9586 |
Hashes for asgi_tools-0.50.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 592b94fec0f9490fe52d4e20e67c63735c7309b4508229a65144599a475b1d26 |
|
MD5 | 2848620e24c871f80d92320c433fa166 |
|
BLAKE2b-256 | 5e5ecdc16ccfd27b341fda0d484c1d8cd16265863668f821813faff5811aa867 |
Hashes for asgi_tools-0.50.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07f0d928776538ccc4d39dd3f4b92b01f8234e1c65e2af0f4ac4bb669e17dddb |
|
MD5 | 2b1636d729c92f8255a3955a83e0c5a1 |
|
BLAKE2b-256 | 26776d089c7e5d2a2fbe0ae2e466eb1024f8d091a3a0d1a62635332a11824d6e |
Hashes for asgi_tools-0.50.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 609b5526d67dfc8c74aca416b400fcb261736ddc9d329c3a4c8947ee37718ed3 |
|
MD5 | 76f79c14192c3e10f6e78677a08803db |
|
BLAKE2b-256 | 5d143b39433abc8264b2e9c41ff5439e5f9bbc4cfaa79fbbee8eb23e4f7cbd28 |
Hashes for asgi_tools-0.50.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 221e886bc2959b23999177966ada611cf08d404c275bcd2fb7b7393a3ee66245 |
|
MD5 | bb3a6618794cc0babb31999cd03dc21f |
|
BLAKE2b-256 | a8356f95cfef14e21df26390ad7acb94ada031d10393f6bf697db67f9bd1ba9b |
Hashes for asgi_tools-0.50.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1bd95e6ce4bb1c7efb7328bde7155c0cdd8ad6130721c72589b7d1260a45a3c |
|
MD5 | 610e28d398bb5c20cfff8efaeb7f9a6b |
|
BLAKE2b-256 | 5e0c3372e1c9219f1eaa242b0238ecfde0f968ba068ba084984425db1bf0a60c |
Hashes for asgi_tools-0.50.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 937b0a79e15f6d34410e3a381e15e3b2b77af3f986e1863cf2df404c95517167 |
|
MD5 | 3a90b4ee968b8df2e2e0006e184d3ad3 |
|
BLAKE2b-256 | 15759ceeb0225be7bc8a1a47e13b857c8e417c7292fa8bcf944b598fbf508759 |
Hashes for asgi_tools-0.50.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d00d2042996bd0d53954ef6fc00b2bfed566eb5fc3f9c41ef7f382cf41f493d9 |
|
MD5 | 180a847af92127a97e4dcb00f811b02e |
|
BLAKE2b-256 | 9450d7b54da796f11ade3cc892cd838aec455a24ea318572c272004e761320e4 |