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.59.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 954a1e49f91189faf84c2c89755eb2617a5eb1ce57814204c50b3257ce62d94d |
|
MD5 | 36a60d357855a5af9cb488bc99bfdfa1 |
|
BLAKE2b-256 | fc78c764ee636b06d6f041781aa2b47c9be0cc58d673dd47404b228912cd7e5c |
Hashes for asgi_tools-0.59.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb2d65fd0e85da43155f0e940828da5ef58530eeff6e661dd68988934447ca32 |
|
MD5 | a4943f07a628ffe5cfcf82744e922330 |
|
BLAKE2b-256 | 4c38e900285610dd335b4f1be2e8f8283ae91aeaa7e60b49d1cc3fb9780f42bb |
Hashes for asgi_tools-0.59.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 900f8ab2bfb0c26c82013a1e3cb041ee7a644292132c9870367cb27329360cba |
|
MD5 | 3f66c05de18f2d290e7b499d650a6f08 |
|
BLAKE2b-256 | 486735dd30f172acea89d4e50b199d99168208417b2d2b08f1addae8b43e322c |
Hashes for asgi_tools-0.59.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48acc5ea38078b8bfadce0f82122a80ccf0df04b174263cc4bacdc7438bae9da |
|
MD5 | 822fa7986788173c59def38f5867d9a8 |
|
BLAKE2b-256 | 3f9f62de00fbddfe28aff0ff5539cb6e5f2358779197bb2412d85f1deb3f5ed9 |
Hashes for asgi_tools-0.59.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd72e9fe4560fd91e72869df1361f9d22f98d521985de32fb49699ae096c297f |
|
MD5 | 0f3d4c56e4b886a97c6bbce902cceace |
|
BLAKE2b-256 | ae9d56523208d876a2eb6171956015d3e8b4fd80f82185057314fcbeed8f61f2 |
Hashes for asgi_tools-0.59.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2adb41da22e5ee9de795e6447db884554709cd2a8d695a52d6ff9ceea2557301 |
|
MD5 | 72a1ff2157757815c37d112334100cf4 |
|
BLAKE2b-256 | 3819453bd7815f3ec3226baabcc07383b2a6f57cd3416cd454ade4d2f93e330f |
Hashes for asgi_tools-0.59.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bb7626649586931b94a95159c72e0bbd2d169b0d56ec5684cf3aba6091a72b1 |
|
MD5 | 6a31f240a8eb0fbdb1a68f571216ee55 |
|
BLAKE2b-256 | ca6c6752a2c444938bab4a65200ffc924bd86f57e0ad90dc016cbd1dd5121557 |
Hashes for asgi_tools-0.59.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7b16821b52400c2a27e4624bb9cfe42444bb6086d734fde8c5aa5a61d055560 |
|
MD5 | 9d4bf70f9e3731757baa7ea1bc48fa96 |
|
BLAKE2b-256 | b4abd974cb3b3a1a6c4e9c49c5e243a44aee3b86ed6dc110d31d789d3e8eaefe |
Hashes for asgi_tools-0.59.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2334b35e40b1c4b927e8617a775666561afede6ba013ef83aac3423082594859 |
|
MD5 | 9c6c92d867bf635e1577e179a7e9a855 |
|
BLAKE2b-256 | 8f8d0a27a08b043311e77988a6ef887cb47e186f097479a5592c62953cfc7a1d |