Python SDK for the EchoProxy HTTP observability platform — capture inbound + outbound HTTP traffic
Project description
echoproxy
Python SDK for the EchoProxy HTTP observability platform.
Install
pip install echoproxy
export ECHOPROXY_API_KEY=sk_live_xxx
export ECHOPROXY_ENDPOINT=http://localhost:8081
Capture inbound requests
FastAPI / Starlette / Django ASGI
import echoproxy
from echoproxy.asgi import CaptureMiddleware
client = echoproxy.Client()
app.add_middleware(CaptureMiddleware, client=client)
Flask / Django WSGI
import echoproxy
from echoproxy.wsgi import CaptureMiddleware
client = echoproxy.Client()
app.wsgi_app = CaptureMiddleware(app.wsgi_app, client)
Capture outbound HTTP — pick a mode
There are two ways to capture outbound calls. Pick one per project.
Proxy mode (echoproxy.proxy) |
Capture mode (echoproxy.httpx_hook) |
|
|---|---|---|
| Who calls the upstream | proxy-gateway (Go) | your app (httpx) |
| Where the event is emitted | proxy-gateway → Kafka | SDK → ingest-api → Kafka |
| Latency added | ~1 hop to proxy-gateway | ~µs (event buffered + async flush) |
upstream_latency_ms |
measured server-side via httptrace (authoritative) |
measured client-side from time.perf_counter() |
upstream_ttfb_ms |
yes, real TTFB | 0 (httpx doesn't expose TTFB) |
| Body capture cap | enforced in proxy-gateway | enforced in SDK |
| Code change | swap requests import |
add 1 line to httpx.Client(...) |
Dashboard source |
proxy-gateway |
sdk-python |
| Dashboard mode badge | proxy | capture |
When to use which
- Proxy mode — the default. Use whenever your app can reach
proxy-gateway:8080. You get the most accurate timing (TTFB, upstream RoundTrip, proxy overhead) and don't have to manage flush/buffer state in your process. - Capture mode — use when (a) your runtime can't reach the proxy (Lambda with VPC restrictions, Fly.io firewall, edge runtime), (b) you already use httpx and want zero hop, or (c) you need to capture calls from libraries that ignore
http_proxyenv vars.
Proxy mode — drop-in for requests
import echoproxy.proxy as sid # mirrors requests.* API
r = sid.get("https://api.openai.com/v1/models")
r = sid.post("https://api.stripe.com/v1/charges", data={...})
Or get an explicit Session:
import echoproxy.proxy as sid
session = sid.session(api_key="sk_live_xxx", proxy_url="http://proxy-gateway:8080")
session.get("https://api.example.com/users")
Capture mode — httpx event hooks
import httpx, echoproxy
from echoproxy import httpx_hook
client = echoproxy.Client()
http = httpx.Client(event_hooks=httpx_hook.hooks(client))
Redaction
The SDK ships with the same scrub list as the Go reference (pkg/redact):
- Headers:
Authorization,Cookie,X-Api-Key,X-Auth-Token,X-CSRF-Token, … - JSON fields:
password,token,secret,api_key,credit_card, … - Patterns: JWT, Bearer, AWS keys, Stripe, GitHub, Google API, Slack, Luhn-validated cards.
Extend:
from echoproxy import Client, Config, Redactor
client = Client(Config(
redactor=Redactor(
extra_headers=("X-Customer-Email",),
extra_json_fields=("account_number",),
),
))
ingest-api re-applies the same rules server-side, so misconfiguration here is not a wire-leak risk.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file echoproxy-0.4.0.tar.gz.
File metadata
- Download URL: echoproxy-0.4.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94b0731896de456a9fed509d9ef54ac06ce3670c6211083ac022fe187d4cc6a0
|
|
| MD5 |
de5587332cc19a92d07b2247c97cf388
|
|
| BLAKE2b-256 |
2502fe63cdd26b300f93868e07644b356c52de59e521c2f384f1ce5306d24c70
|
Provenance
The following attestation bundles were made for echoproxy-0.4.0.tar.gz:
Publisher:
publish-sdks.yml on songhieu/EchoProxy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
echoproxy-0.4.0.tar.gz -
Subject digest:
94b0731896de456a9fed509d9ef54ac06ce3670c6211083ac022fe187d4cc6a0 - Sigstore transparency entry: 1576548184
- Sigstore integration time:
-
Permalink:
songhieu/EchoProxy@c813f8d3c0c1ca012aae0590bbb766143364b233 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/songhieu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@c813f8d3c0c1ca012aae0590bbb766143364b233 -
Trigger Event:
push
-
Statement type:
File details
Details for the file echoproxy-0.4.0-py3-none-any.whl.
File metadata
- Download URL: echoproxy-0.4.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ff1056f88910aeb59a937423bfe511d8569b57b6697ab05844ab9a179e3ca7d
|
|
| MD5 |
b895089e38b992de1c1c7532b07a5c17
|
|
| BLAKE2b-256 |
e55a4263aeea4e808e104ba98d313ec98d42db4a4c934188910f3f42d4d296ed
|
Provenance
The following attestation bundles were made for echoproxy-0.4.0-py3-none-any.whl:
Publisher:
publish-sdks.yml on songhieu/EchoProxy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
echoproxy-0.4.0-py3-none-any.whl -
Subject digest:
8ff1056f88910aeb59a937423bfe511d8569b57b6697ab05844ab9a179e3ca7d - Sigstore transparency entry: 1576548522
- Sigstore integration time:
-
Permalink:
songhieu/EchoProxy@c813f8d3c0c1ca012aae0590bbb766143364b233 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/songhieu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@c813f8d3c0c1ca012aae0590bbb766143364b233 -
Trigger Event:
push
-
Statement type: