MCP_Res / mcp /ensembl.py
mgbam's picture
Update mcp/ensembl.py
b1bf985 verified
import httpx
from functools import lru_cache
_URL = "https://rest.ensembl.org/xrefs/symbol/homo_sapiens/{}?content-type=application/json"
@lru_cache(maxsize=512)
async def fetch_ensembl(sym: str):
async with httpx.AsyncClient(timeout=8) as c:
r = await c.get(_URL.format(sym))
return r.json()[0] if r.status_code == 200 and r.json() else {}