Skip to main content

Drop-in ASGI/WSGI middleware for endpoint timing

Project description

philiprehberger-api-timer

Tests PyPI version License

Drop-in ASGI/WSGI middleware for endpoint timing with Server-Timing headers.

Installation

pip install philiprehberger-api-timer

Usage

ASGI (FastAPI, Starlette)

from fastapi import FastAPI
from philiprehberger_api_timer import ASGITimerMiddleware

app = FastAPI()
app.add_middleware(ASGITimerMiddleware, slow_threshold_ms=500)

WSGI (Flask, Django)

from flask import Flask
from philiprehberger_api_timer import WSGITimerMiddleware

app = Flask(__name__)
app.wsgi_app = WSGITimerMiddleware(app.wsgi_app, slow_threshold_ms=500)

API

Function / Class Description
ASGITimerMiddleware(app, slow_threshold_ms=500) ASGI middleware
WSGITimerMiddleware(app, slow_threshold_ms=500) WSGI middleware

Development

pip install -e .
python -m pytest tests/ -v

License

MIT

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

philiprehberger_api_timer-0.1.6.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

philiprehberger_api_timer-0.1.6-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_api_timer-0.1.6.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_api_timer-0.1.6.tar.gz
Algorithm Hash digest
SHA256 2136e7b3fc34bef33e51d19a748f3c29c87c8053aaae456a474085a3b579ae05
MD5 6f60e41539320b91e5ce2014e21fb41b
BLAKE2b-256 b62750c636c533fe5ce3ccd96ef627430df46a80d0d1f74aa3cf55fc9de3e281

See more details on using hashes here.

File details

Details for the file philiprehberger_api_timer-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_api_timer-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1cde62dc816f273f61030f4f41a714fce0f179e13f107a9eca913e7c5a91f958
MD5 3650a01981dc4a40c869be2d7ad3973e
BLAKE2b-256 3f46d31e92906e07104e714a2360afba0ed021fac78b06b4f03bea02a5aabf5e

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