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.51.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11ab52a337547f1b7da95c65e5293c22404d5c7100431a25fbfd9f8a322346f7 |
|
MD5 | 44d589bbf2675edd04027443b7171f86 |
|
BLAKE2b-256 | b76d80ea2f67079e24dcc3c95a4b72c9409b4758fcc1e56a0c90b4a9ab7cb606 |
Hashes for asgi_tools-0.51.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 514797c9d9c652aed14657cf9bdad51066647c5613c5289988392d45214b4d70 |
|
MD5 | afd9ccdf2be1eda91d786a005667f073 |
|
BLAKE2b-256 | 89f389f7e7a2e6b826fe84e482c959049b25fd5ffeac978a1b36b724253297ba |
Hashes for asgi_tools-0.51.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d516cd1d281f65d5a51804da70dbb24672ba77ef39011422389b327202fdd57 |
|
MD5 | 1eb82186618d51d0f6a7e29eaad396b3 |
|
BLAKE2b-256 | 1320d7fa330cdb15b171cba99f8c8f77f36221c707d0dc0895c6d0a5be56cb9f |
Hashes for asgi_tools-0.51.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a166afc0082a61d2adbba9f2db32442cfce8119328d55fb407ccbfddfd9ba52 |
|
MD5 | c213320741d7d0220c2a99d0e2a580d8 |
|
BLAKE2b-256 | fb46801d12b1e147e18ca4c5efcf50429a1972f2fff3fec06d1e8bcdf1eea151 |
Hashes for asgi_tools-0.51.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d72ee99263c4b37a55f17b4144e0d1715f823ba5867a6c228dade93285245dad |
|
MD5 | 9dad0886986f158e4dcf952d44d691cf |
|
BLAKE2b-256 | daa8e529c8fafa60b294106a1032c8c166bd04605d5a5c6364a15828a25ffdc9 |
Hashes for asgi_tools-0.51.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9801f7b29f54caf5d07ee80c84cd4755602aec86510eef66567b671790ad8a3 |
|
MD5 | de93322e917788fcae4487c14de6f1f5 |
|
BLAKE2b-256 | 8b522619a321e6a6fa476ee13720b5995700c1a8f770d0378ab6e47f3454ff5a |
Hashes for asgi_tools-0.51.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16bf8d20c69d920709ffa85887048a431acc3678b5f7e2f95e31c4066ad42e47 |
|
MD5 | 76de1d6fa0a65ee807ae00062cb69b35 |
|
BLAKE2b-256 | 3f31e2ca9338eb77180efa69f44c44e227eecf6c05130f39ef09c2498f9a964a |
Hashes for asgi_tools-0.51.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 536a32f7a0f02925a7807b3483d60cf09d863b485f18079a613195e47b5e5783 |
|
MD5 | da43c17690d8aac615b5a1b5da1a22f6 |
|
BLAKE2b-256 | 00dd0be65b93948650737c2d921fe8448fad309f07c8d40e9c6b248981f7f36e |
Hashes for asgi_tools-0.51.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b5facb9822d8b7c3dabc806123c4403fa559cda81112e4af5fe0626dc190c3e |
|
MD5 | a2feff414c75b7e4a4f3996a1ead81b5 |
|
BLAKE2b-256 | 546eb40494d92e550e3386731c1a6160bfe7080c94476484e94f71067d04e561 |