Skip to content
CribScore
Skip to content
CribScore Docs

Recipes

Python Starter

Python starter — `httpx`, retry policy, env-driven auth, trust pre-flight cache. Copy into a service and you have a working client.

Setup#

Use `httpx` for synchronous or async support. Wire the bearer token from env; keep retries explicit; set a sensible timeout.

pip install httpx

Decision memo#

Generate an explainable shortlist. The memo is JSON; render the `summary` field in your UI and use the `shortlist` rows to drive a comparison table.

Memopython
import httpx

response = httpx.post(
    "https://api.cribscore.co/v1/decision/memo",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
        "geography": "90003",
        "child_age_months": 24,
        "budget_weekly": 350,
        "shortlist_limit": 3,
        "priorities": ["safety_score", "license_status", "commute_minutes"],
    },
    timeout=60.0,
)
response.raise_for_status()
memo = response.json()
print(memo["summary"])
for option in memo["shortlist"]:
    print("-", option["facility_id"], option["recommendation"])

Trust pre-flight#

Cache the jurisdiction list at startup and gate workflow entry on tier. This is the single most valuable wrapper to add — it prevents non-decision-grade data from leaking into recommendations.

Trustpython
import httpx

response = httpx.get(
    "https://api.cribscore.co/v1/trust/jurisdictions",
    params={"limit": 25},
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    timeout=30.0,
)
response.raise_for_status()
for jurisdiction in response.json()["data"]:
    print(
        jurisdiction["state_code"],
        jurisdiction["trust_tier"],
        jurisdiction["scored_facility_count"],
    )