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.61.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ff2b21cb80e0242f2db759e2f6379099c3b49476f66b861943e7f64cbac086f |
|
MD5 | 2eef3c931c217d8345f06f6baf469b41 |
|
BLAKE2b-256 | 8aafcd262143b95cfed8fc56a71573aac8da8dd13ef0a724d161d04c7ef70327 |
Hashes for asgi_tools-0.61.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78cf44050a5fe835be804a21c38a3b7487f3d5661ae9ac02cb8edac8797e4455 |
|
MD5 | 60e5fa0a4a3a44cb7d0f74c1e4c36876 |
|
BLAKE2b-256 | 72493679c708b5991ba050bf555c1da5a3dc1b0bc20cc2d36484c86b4eefd941 |
Hashes for asgi_tools-0.61.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23df81ebaf530d5f0b7675967b6247e768c30400a39b3999a73f8eab3d1893cf |
|
MD5 | b48ae5c249278754dce2095b95bde645 |
|
BLAKE2b-256 | 45dd44274929e56aa11854d72de57d33086e2953d0801f1e63441cef5728a105 |
Hashes for asgi_tools-0.61.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 174fe3c8251c01d3005148f8259d51c290018e29e75516ad5b3742f4338f23d3 |
|
MD5 | 56425595804b291ba2f0395db6b2da7e |
|
BLAKE2b-256 | 758d5e9bf5b0fefe8521ae060c7c10a87e106737c1d47cb3a0bacaa4ca9765d3 |
Hashes for asgi_tools-0.61.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eb3aaf6c7caf7894b68f0258eac8ae7b8f7f142f6882a493229a112ccc12479 |
|
MD5 | d5b693656b36331548dd16d1c2255507 |
|
BLAKE2b-256 | 36020afbc73821fe1af1c768f58ae2cb4524589c4679a8d5fc48d79919fe13b8 |
Hashes for asgi_tools-0.61.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2368c825049b614117e99435a3e971c6ef5091d9ff5f1d5cb95bf5838ee363d3 |
|
MD5 | 798cb321286dcfac9ee1455edddb8744 |
|
BLAKE2b-256 | 2ed1ed2fac6ce452f92b15e4a7f9bd5c17f8697dd47ca655e38001d2b5381358 |
Hashes for asgi_tools-0.61.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 068fc96f2aff2de8054cc141453e34c38577f1489e02f6fbae8fb1b953d54336 |
|
MD5 | cb62b9ea5986d2995227816d851bc8c3 |
|
BLAKE2b-256 | eeb4318a0c78cc3c0287b3b02c7cd5739235697f73e460400adf5d7c515dfad0 |
Hashes for asgi_tools-0.61.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96d4b5b0db8a2ba51756f7d058aa8d0460055963696ed155bd2d214d58da3640 |
|
MD5 | 1d52c646f501df3cdc7a915de9da1e0c |
|
BLAKE2b-256 | 6cd4f48d2cdb350a67c6a606308f01707fd2a658d3eb556c91fd0df93ab1ad60 |
Hashes for asgi_tools-0.61.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 720b1fa77aa0908c038ea63436b4b5d46ffb09e90524b2435e29b148be429fb4 |
|
MD5 | 0495c91cf9ea8ae12e39d8848695de8f |
|
BLAKE2b-256 | 191beca6244da8ddb0e6c67f14cd8d393e79b5845a286ac22078ac67fcc6a237 |