"""DrugCentral async wrapper (https://drugcentral.org/api). | |
Provides drug metadata, approvals, MoA, off‑label, etc. | |
""" | |
import httpx, asyncio | |
from functools import lru_cache | |
_BASE = "https://drugcentral.org/api/v1/drug" | |
async def fetch_drugcentral(drug_name: str) -> dict | None: | |
async with httpx.AsyncClient(timeout=10) as client: | |
resp = await client.get(_BASE, params={"name": drug_name}) | |
if resp.status_code == 404: | |
return None | |
resp.raise_for_status() | |
return resp.json() |