
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
.. image:: https://raw.githubusercontent.com/klen/asgi-tools/develop/.github/assets/asgi-tools.png :height: 100
.. _description:
asgi-tools -- Is a really lightweight ASGI_ Toolkit to build ASGI applications faster.
.. _badges:
.. image:: https://github.com/klen/asgi-tools/workflows/tests/badge.svg :target: https://github.com/klen/asgi-tools/actions :alt: Tests Status
.. image:: https://github.com/klen/asgi-tools/workflows/docs/badge.svg :target: https://klen.github.io/asgi-tools :alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/asgi-tools :target: https://pypi.org/project/asgi-tools/ :alt: PYPI Version
.. image:: https://img.shields.io/pypi/pyversions/asgi-tools :target: https://pypi.org/project/asgi-tools/ :alt: Python Versions
.. _documentation:
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:
ASGI-Sessions <https://github.com/klen/asgi-sessions>
_ASGI-Babel <https://github.com/klen/asgi-babel>
_ASGI-Prometheus <https://github.com/klen/asgi-prometheus>
_.. _features:
Features:
Asyncio
, Trio
and Curio_Request
_ -- Parse ASGI scope, get url, headers, cookies, read a request's data/json/form-dataResponse
_ -- Send HTTP (text, html, json, stream, sse, file, http errors) responsesResponseWebsocket
_ -- Work with websocketsRequestMiddleware
_ -- Parse a scope and insert the parsed request into the scopeResponseMiddleware
_ -- Parse responses and convert them into ASGI messagesRouterMiddleware
_ -- Route HTTP requestsLifespanMiddleware
_ -- Process a lifespan cycleStaticFilesMiddleware
_ -- Serve static files from URL prefixesasgi_tools.tests.TestClient <https://klen.github.io/asgi-tools/api.html#testclient>
_ -- A test client with websockets support to test asgi applicationsApp
_ -- A simple foundation for ASGI apps.. _contents:
.. contents::
.. _requirements:
.. note:: pypy3 is also supported
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
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
.
.. code-block:: python
from asgi_tools import App
app = App()
@app.route('/')
async def hello(request):
return "Hello World!"
Run it with uvicorn
.. code-block:: sh
$ uvicorn app:app
.. _bugtracker:
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
_.
.. _links:
.. _ASGI: https://asgi.readthedocs.io/en/latest/ .. _Asyncio: https://docs.python.org/3/library/asyncio.html .. _Curio: https://curio.readthedocs.io/en/latest/ .. _MIT license: http://opensource.org/licenses/MIT .. _Trio: https://trio.readthedocs.io/en/stable/index.html .. _klen: https://github.com/klen .. _uvicorn: http://www.uvicorn.org/ .. _daphne: https://github.com/django/daphne/ .. _hypercorn: https://pgjones.gitlab.io/hypercorn/
.. _Request: https://klen.github.io/asgi-tools/api.html#request .. _Response: https://klen.github.io/asgi-tools/api.html#responses .. _ResponseWebSocket: https://klen.github.io/asgi-tools/api.html#responsewebsocket .. _RequestMiddleware: https://klen.github.io/asgi-tools/api.html#requestmiddleware .. _ResponseMiddleware: https://klen.github.io/asgi-tools/api.html#responsemiddleware .. _LifespanMiddleware: https://klen.github.io/asgi-tools/api.html#lifespanmiddleware .. _StaticFilesMiddleware: https://klen.github.io/asgi-tools/api.html#staticfilesmiddleware .. _RouterMiddleware: https://klen.github.io/asgi-tools/api.html#routermiddleware .. _App: https://klen.github.io/asgi-tools/api.html#application
FAQs
ASGI Toolkit to build web applications
We found that asgi-tools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.