Quickstart: Python
Send your first trace from Python.
Install & configure
No published PyPI package in MVP—use a small httpx snippet.
import os, httpx, json
from datetime import datetime, timezone
API = os.environ["INTERTRACE_API_URL"] # e.g. https://your-app.com
KEY = os.environ["INTERTRACE_API_KEY"]
def post_trace(body: dict):
r = httpx.post(
f"{API}/api/v1/telemetry/traces",
headers={
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
"Idempotency-Key": body.get("idempotency_key", "demo-1"),
},
json=body,
timeout=30.0,
)
r.raise_for_status()
return r.json()
payload = {
"trace": {"name": "python_quickstart", "metadata": {}},
"spans": [{
"name": "hello",
"kind": "chain",
"start_time": datetime.now(timezone.utc).isoformat(),
"end_time": datetime.now(timezone.utc).isoformat(),
"attributes": {"note": "first span"},
}],
}
print(post_trace(payload))