Skip to main content

Is a toolkit to build ASGI applications faster

Project description

https://raw.githubusercontent.com/klen/asgi-tools/develop/.github/assets/asgi-tools.png

asgi-tools – Is a toolkit to build ASGI applications faster

Tests Status Documentation Status PYPI Version Python Versions

Documentation is here: https://klen.github.io/asgi-tools


Features:

  • Supports Asyncio and Trio libraries

  • Request – Parse ASGI scope, get url, headers, cookies, read a request’s data/json/form-data

  • Response – Send HTTP (text, html, json, stream, 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.6

Installation

asgi-tools should be installed using pip:

pip install asgi-tools

A Quick Example

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

asgi_tools-0.25.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file asgi_tools-0.25.0-py3-none-any.whl.

File metadata

  • Download URL: asgi_tools-0.25.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for asgi_tools-0.25.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c9f15244d95838662eadb1a3d53a8bc3f40d1d3c10b92c57e9065ace25092a6
MD5 1c69102fb2ba515f70ba77d733a52012
BLAKE2b-256 12d9060c0064ab83bde1a55580c0cd537c97b0fbfcee5b688cca27e7d1a2b011

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page