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.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20404ef96e1a6aa2cfd69aae45cf69428f299490be0d2745baedfbb1a3a50463 |
|
MD5 | 16cb5a67b728287ab30c34bec590172f |
|
BLAKE2b-256 | 5d56f5628c6be4865be55bd9164e87db6270b5e1fdd9bdb7370863d511d91402 |
Hashes for asgi_tools-0.48.3-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7e5d213f2df93e75964802dfc6c3ee42cec395dc36f1561fb745f6b5fb5f2e7 |
|
MD5 | ace9c7d40e0945408d1e83932f99bae0 |
|
BLAKE2b-256 | d3dec44096f86733e590547f230f65d097b16f2e19b4dd2d2370b8b8f107ce14 |
Hashes for asgi_tools-0.48.3-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42c48fd33721f62c7ead651fe21b4ab1e01072dfe8c62da9323848549164b5e |
|
MD5 | b209712bd99ff222de12802eae93856a |
|
BLAKE2b-256 | f068d2a42815d91588117fe48f32032c3c8f2397110791e0b694354d3b82dd84 |
Hashes for asgi_tools-0.48.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6effdb8ce5dd8928cd91a779e8d62d4ed54c04a302b7857de9d61b5c5982e069 |
|
MD5 | 59ede7c63ff86c168c744e26767886c1 |
|
BLAKE2b-256 | 141931e6e6021f44b6dd9a639e06cc55a7ab1e2bc33461600f968fd5bafe8ab2 |
Hashes for asgi_tools-0.48.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8598126ea6d9274c72c1e5bd686b45653baaddde1a2ce45ac03d2f298b1ae12 |
|
MD5 | aa06122d4c8603085758c05dd649f18e |
|
BLAKE2b-256 | 2ed33aa87c1cc33e6c2edc15270c77241ef6ef63085f38701ccacdedc9c0c03e |
Hashes for asgi_tools-0.48.3-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b4577c32406c695dacb28190253d6f2b6a3f41ad8e5370afd6083202f4c8af2 |
|
MD5 | 6d16066f728958040d1512894bff3dbf |
|
BLAKE2b-256 | a7c72b57500b2e623b90fcb38a7f1ae6685afc504e6cf25e71921574f50f8aac |
Hashes for asgi_tools-0.48.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe2ca7e635175d3708e5a34d69db95c184670bf4a2cc76aad3bd37bc652284cf |
|
MD5 | ca1f757d0389f92cbb862392448d609e |
|
BLAKE2b-256 | d85d0f497167828156879374d7cc16b924bf2e15d29a309b4defb751c51e572e |
Hashes for asgi_tools-0.48.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77ca6724fac5dcf2c18e5e2c74859818b4afdb5399af5f55b04ab4f44483d41f |
|
MD5 | 48bbfa65079ab265f78f3846db3aeaa7 |
|
BLAKE2b-256 | 4639713d3fa2dfe8bb096a28f2a0028920b2c8e1a95d03064ffb0771f2f77dec |
Hashes for asgi_tools-0.48.3-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ff5666b0c369738511315eb0b936ab3fed22550b878289e451484ed56c9fc63 |
|
MD5 | 4b4250865ebf266d0795a556f56fad58 |
|
BLAKE2b-256 | 5253091e34bae20e7d86cfff7b3f4473db4804156c7e3288c161ca4adc73779b |