Download mcp/mygene.py from mgbam/MCP_Res: direct link, hf CLI and curl.
- Browser
- Download file 496 Bytes
-
https://huggingface.co/spaces/mgbam/MCP_Res/resolve/874a822366181ef5fee5870fc63da0cd490d39d3/mcp/mygene.py
- Command line
-
hf download hf://spaces/mgbam/MCP_Res@874a822366181ef5fee5870fc63da0cd490d39d3/mcp/mygene.py
-
curl -L -o mygene.py https://huggingface.co/spaces/mgbam/MCP_Res/resolve/874a822366181ef5fee5870fc63da0cd490d39d3/mcp/mygene.py
496 Bytes
| import os, httpx, asyncio | |
| from functools import lru_cache | |
| _KEY = os.getenv("MYGENE_KEY"); _URL="https://mygene.info/v3/query" | |
| async def fetch_gene_info(sym: str): | |
| p={"q":sym,"fields":"symbol,name,summary,alias,entrezgene,location","size":1} | |
| if _KEY: p["api_key"]=_KEY | |
| async with httpx.AsyncClient(timeout=8) as c: | |
| r=await c.get(_URL,params=p); r.raise_for_status() | |
| return r.json().get("hits",[{}])[0] | |
| ``` :contentReference[oaicite:7]{index=7} |