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.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded CPython 3.11Windows x86-64

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

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

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

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

File details

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

File metadata

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

File hashes

Hashes for asgi_etags-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3c2ebd08c98c7d38d9410b7ca73623a0ee509f7dfbfb3e79f4e6e48561b922dc
MD5 bd813f9308e46077ccbfb4f7cb94358a
BLAKE2b-256 77fa8030aad00a87c762e019c93e83625402691af50f43a7a0bbcaefe8cea653

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asgi_etags-0.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 58.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.9.3 CPython/3.10.12

File hashes

Hashes for asgi_etags-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 943873b176207923cdcaf7a623402ad7e55c36222f95f35cb71b70712ddb7b52
MD5 d651cb44a1bb32539f709c023653a532
BLAKE2b-256 21f1517976a0cf9a5dab9fc676269a9f06f3fb2242aa0be17d073cceee640eaf

See more details on using hashes here.

File details

Details for the file asgi_etags-0.2.0-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.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 17892295023850cd9ee8d9b5a60aa7431cd57fddc9e62cabb59a40fa1c92932b
MD5 e4aa5b635f8dedc2a5677fae080775fc
BLAKE2b-256 9eb9b9901d80e239cf3711945d5cb49b06b7df7c560e22476301f28b9dde7cf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asgi_etags-0.2.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3f8dcd7205dde33616f60b49591b543e938e2104ad3d977800025184841b8359
MD5 3b86c6770296d483333e5def6671d557
BLAKE2b-256 a13fbf9878381fc47f08e104fd9734f3f064e93bf4fc6d65e2a87ced46e28ee1

See more details on using hashes here.

Supported by

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