Download mcp/ctgov.py from mgbam/MCP_Res: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/spaces/mgbam/MCP_Res/resolve/8e8bfa64459c58f44ea635139b38e6b394629682/mcp/ctgov.py
- Command line
-
hf download hf://spaces/mgbam/MCP_Res@8e8bfa64459c58f44ea635139b38e6b394629682/mcp/ctgov.py
-
curl -L -o ctgov.py https://huggingface.co/spaces/mgbam/MCP_Res/resolve/8e8bfa64459c58f44ea635139b38e6b394629682/mcp/ctgov.py
447 Bytes
| import httpx, asyncio, datetime | |
| _BASE = "https://clinicaltrials.gov/api/v2/studies" | |
| async def search_trials(query: str, max_n: int = 20) -> list[dict]: | |
| async with httpx.AsyncClient(timeout=15) as cli: | |
| r = await cli.get(_BASE, params={ | |
| "query": query, | |
| "pageSize": max_n, | |
| "fields": "nctId,briefTitle,phase,status,startDate" | |
| }) | |
| r.raise_for_status() | |
| return r.json().get("studies", []) | |