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 hashes)
Built Distributions
Close
Hashes for asgi_etags-0.2.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e111015ce2b0ad122f9765bf7490de58ee46f6a0311ff3f2beef30df8167873f |
|
MD5 | a17081c2504ef001c1fd48c0df6577c7 |
|
BLAKE2b-256 | 4d9d96788e677e69ed006c2bd3d1f2df94ca89be60b51dfc507d1d5229aa95c2 |
Close
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 |
Close
Hashes for asgi_etags-0.2.1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31905b1c62c9bcabffe4a6b776a3988a7c11b9eb45f8a963974b949481a3f76d |
|
MD5 | 7162493f1f088144eeaf0c545ed53ee7 |
|
BLAKE2b-256 | c2576447e2e38849ad0a3e3ea1b3d06a55d2dfe32cc26762a93494bfefeb3413 |
Close
Hashes for asgi_etags-0.2.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5c84f13462f87cb381de75ec402d821f6732e6fd4cca3acd6d3ddcac8b2b57b |
|
MD5 | 39ef16334e73c25b42efde08799c8fc8 |
|
BLAKE2b-256 | 2f6656fa9982522ef8d00c3771b547a382751ec46c8648a9f8ce11efd4abb6f4 |
Close
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 |
Close
Hashes for asgi_etags-0.2.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55a4cbfccd05c304bbc006ff476514a65250654e6be2fdd5b03c746f57b11f47 |
|
MD5 | 0974b65f65d3d3834022ed8336f12079 |
|
BLAKE2b-256 | c2b5e9434b0ce501eb378151bdf7eb8b9fd139e16316aff569ce7857a1f51c0d |