Download mcp/drugcentral.py from mgbam/MCP_Res: direct link, hf CLI and curl.
- Browser
- Download file 553 Bytes
-
https://huggingface.co/spaces/mgbam/MCP_Res/resolve/0dab0c08ffda851a112d05cdfe0364d5f93fa139/mcp/drugcentral.py
- Command line
-
hf download hf://spaces/mgbam/MCP_Res@0dab0c08ffda851a112d05cdfe0364d5f93fa139/mcp/drugcentral.py
-
curl -L -o drugcentral.py https://huggingface.co/spaces/mgbam/MCP_Res/resolve/0dab0c08ffda851a112d05cdfe0364d5f93fa139/mcp/drugcentral.py
553 Bytes
| """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() |