Skip to main content

No project description provided

Project description

asgi_etags

Simple etags middleware for asgi apps.

Installation

The library is available on PyPI:

pip install asgi_etags

Or in the Releases tab, both in sdist format as well as wheels.

Supported Python versions

Currently the library supports Python 3.11 only.

Example usage:

With FastAPI

from fastapi import FastAPI
from hashlib import md5
from asgi_etags import ETagMiddleware

app = FastAPI()
app.add_middleware(ETagMiddleware, etag_generator=lambda body: md5(body).hexdigest())

@app.get("/")
def hello_world():
    return {"hello": "world"}

With Litestar

from litestar import Litestar
from hashlib import md5
from asgi_etags import ETagMiddlewareFactory

@get(path="/", media_type="application/json", sync_to_thread=False)
def hello_world() -> dict[str, str]:
    return {"hello": "world"}


app = Litestar(
    route_handlers=[hello_world],
    middleware=[ETagMiddlewareFactory(lambda body: md5(body).hexdigest())],
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asgi_etags-0.2.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distributions

asgi_etags-0.2.1-cp312-cp312-win_amd64.whl (58.8 kB view details)

Uploaded CPython 3.12 Windows x86-64

asgi_etags-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (155.6 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

asgi_etags-0.2.1-cp312-cp312-macosx_10_9_universal2.whl (154.8 kB view details)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

asgi_etags-0.2.1-cp311-cp311-win_amd64.whl (58.6 kB view details)

Uploaded CPython 3.11 Windows x86-64

asgi_etags-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (149.3 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

asgi_etags-0.2.1-cp311-cp311-macosx_10_9_universal2.whl (150.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file asgi_etags-0.2.1.tar.gz.

File metadata

  • Download URL: asgi_etags-0.2.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.10.0 CPython/3.10.12

File hashes

Hashes for asgi_etags-0.2.1.tar.gz
Algorithm Hash digest
SHA256 492b75c65e983e623a4c57f7daa5513c1ef9e6ca8d6946d4144aa61c27011305
MD5 1872369c15b425ae875c702b2bcdd75d
BLAKE2b-256 1ae72e84f84926bef9c49df7a98abb8b1c24c504cb41afe2615e5b6b671e6cbb

See more details on using hashes here.

File details

Details for the file asgi_etags-0.2.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for asgi_etags-0.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e111015ce2b0ad122f9765bf7490de58ee46f6a0311ff3f2beef30df8167873f
MD5 a17081c2504ef001c1fd48c0df6577c7
BLAKE2b-256 4d9d96788e677e69ed006c2bd3d1f2df94ca89be60b51dfc507d1d5229aa95c2

See more details on using hashes here.

File details

Details for the file asgi_etags-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for asgi_etags-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ebb23ed231fd02ee7143d502204d8350e1b3d71abbab1ae7010f2c10a177c4ec
MD5 5f0ce1dc818fb219c3964b26fc2ebea4
BLAKE2b-256 da1c59d909b98d2021e6ff64b8cf871f65e28203e447b77185a27776857d1339

See more details on using hashes here.

File details

Details for the file asgi_etags-0.2.1-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for asgi_etags-0.2.1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 31905b1c62c9bcabffe4a6b776a3988a7c11b9eb45f8a963974b949481a3f76d
MD5 7162493f1f088144eeaf0c545ed53ee7
BLAKE2b-256 c2576447e2e38849ad0a3e3ea1b3d06a55d2dfe32cc26762a93494bfefeb3413

See more details on using hashes here.

File details

Details for the file asgi_etags-0.2.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for asgi_etags-0.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e5c84f13462f87cb381de75ec402d821f6732e6fd4cca3acd6d3ddcac8b2b57b
MD5 39ef16334e73c25b42efde08799c8fc8
BLAKE2b-256 2f6656fa9982522ef8d00c3771b547a382751ec46c8648a9f8ce11efd4abb6f4

See more details on using hashes here.

File details

Details for the file asgi_etags-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for asgi_etags-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 30fee7ca44087ce0d05b00271c97d7c2818cd43295ace0101bae1e0ee1c0dc27
MD5 aca8991bf23ac87af4fdd3a2d5a7f424
BLAKE2b-256 9883f53a220d99384193d5f89e2d258860dc3639d2ba3b898dd16aedb878fb53

See more details on using hashes here.

File details

Details for the file asgi_etags-0.2.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for asgi_etags-0.2.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 55a4cbfccd05c304bbc006ff476514a65250654e6be2fdd5b03c746f57b11f47
MD5 0974b65f65d3d3834022ed8336f12079
BLAKE2b-256 c2b5e9434b0ce501eb378151bdf7eb8b9fd139e16316aff569ce7857a1f51c0d

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