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())],
)
Metadata
Release files for asgi_etags 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asgi_etags-0.2.1.tar.gz | 4.4 kB | Without provenance | Details for asgi_etags-0.2.1.tar.gz |
Built distributions (wheels)
Total release size: 731.8 kB
Security for asgi_etags 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.