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.7.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.7-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_api_timer-0.1.7.tar.gz
Algorithm Hash digest
SHA256 5105747cf929a35b2474db6046fa8a5cf513f89572ac1cba77d587086614ad12
MD5 93db4e31f95b21a9d7d87f019bf42b2b
BLAKE2b-256 681e40d253c0fdb0f148011095db35896b402c2fcab3cd9b52365339a5c1996b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_api_timer-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8f29f9dd1577c433704f58605481ec8892974db16b440941afb8e3afa308b0dd
MD5 fcb1b6ecdfc132be804165404f823e76
BLAKE2b-256 87d315d65c7357a4507c791e7b8640a868eaf63fa41ac4fe6548d89b6de87d57

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