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.49.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abef584a41a18c109d4c9c84187d1da390d06a1f06b3b07eb169fdd3dc9a39c4 |
|
MD5 | 0432db59389a9a685351481e1efa9189 |
|
BLAKE2b-256 | c3372212db24111580952599d480b5ad55f43ae084843bac4d1bc168e93fe730 |
Hashes for asgi_tools-0.49.1-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17f564204d38844578e603db47d93a2f2104b307c75f3137d90deb6adf7bc6e9 |
|
MD5 | 82775904cf49c9cdcb4f5f57bdf0a273 |
|
BLAKE2b-256 | 9d94ecbc369fa217a405c99ab0f64e0d4493d81fda71481297de82919121370e |
Hashes for asgi_tools-0.49.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6e4fdfdfc19b3a2c0f6a35ef9eb0c5cb9a10b72d472ec7b7098b276bd7adedc |
|
MD5 | 3430da407f8b1b6a453e3ed20735d319 |
|
BLAKE2b-256 | 25574663c1415ad80ec3cd173bcb4f6c6d45f78a0304b688d854dd775973ff3c |
Hashes for asgi_tools-0.49.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea90ff1cdb22ce2e3971b24713f5bb12b35a98bae4684c6cbc71f77d28386c0d |
|
MD5 | 776419f74e02dc1035ea508d41bdc486 |
|
BLAKE2b-256 | ba4d72eccaef5547c751184a34b54891b0c614bad70a0efad9002567384bbc76 |
Hashes for asgi_tools-0.49.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9474cb50ff1545779c5ad514441c32314e875fdfbda2a937a820bb1843199d2e |
|
MD5 | caa2af9f4d83e2ad27f56cb7ffe0359f |
|
BLAKE2b-256 | d2a9fd11b32eea571826b067520c75af296b6557818e78102b31a7978b67cb03 |
Hashes for asgi_tools-0.49.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e61ea69fbebd2de21fca11b80e7d5fb49cf8afb2ccdf238f4f15477d8708447c |
|
MD5 | 54a437112d23495c45c1c7eda231a7ba |
|
BLAKE2b-256 | 87bc2e3d530291504e8ff3c30a76594d8f8dcadbd2fa85bc4fc01f98d7593fa4 |
Hashes for asgi_tools-0.49.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05e50f8ef83abb5d326f0ed37d9c7765060a759b5e46049cb178a82b0d3a7c3c |
|
MD5 | 641d636ccac104a6c47b0c34cd512035 |
|
BLAKE2b-256 | 36dc2ab5aa6ea34761e219b56eb5929812604018fc54d59da0060a2f56f70794 |
Hashes for asgi_tools-0.49.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b28f34d4ea991ec02cf5c349b9caab16200b8cb161386295f65f7d80ba122b18 |
|
MD5 | 7c5c38ed00b7c62292a55f5429e70230 |
|
BLAKE2b-256 | 95b61a6ccb12ca7a86a297ee51ab7d07a2d8e9c4d83b51e3295fc0e438306427 |
Hashes for asgi_tools-0.49.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a75ecf2b67c46a612465cde2fcda733a2866f16a5162efbdc18e7889dd0440a |
|
MD5 | 28ef07d3df42599766a64b30b47b268e |
|
BLAKE2b-256 | 8ee443978e0b88c82f43df07219e0c9ec51666853f10422bf8e48f6e44a00e14 |