Create who.py
Browse files- mcp/who.py +17 -0
mcp/who.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# mcp/who.py
|
2 |
+
"""
|
3 |
+
WHO Global Health Observatory (GHO) OData API helper.
|
4 |
+
Example: fetch essential medicines list or Covid stats.
|
5 |
+
"""
|
6 |
+
|
7 |
+
import httpx
|
8 |
+
from typing import Dict, List
|
9 |
+
|
10 |
+
BASE = "https://ghoapi.azureedge.net/api"
|
11 |
+
|
12 |
+
async def list_essential_medicines() -> List[Dict]:
|
13 |
+
url = f"{BASE}/EML"
|
14 |
+
async with httpx.AsyncClient(timeout=20) as client:
|
15 |
+
r = await client.get(url)
|
16 |
+
r.raise_for_status()
|
17 |
+
return r.json()["value"] # list of medicines
|