Update mcp/ensembl.py
Browse files- mcp/ensembl.py +7 -8
mcp/ensembl.py
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
-
|
2 |
-
```python
|
3 |
-
import httpx, asyncio
|
4 |
from functools import lru_cache
|
5 |
-
|
|
|
|
|
6 |
@lru_cache(maxsize=512)
|
7 |
-
async def fetch_ensembl(sym:str):
|
8 |
async with httpx.AsyncClient(timeout=8) as c:
|
9 |
-
r=await c.get(_URL.format(sym))
|
10 |
-
return r.json()[0] if r.status_code==200 and r.json() else {}
|
11 |
-
``` :contentReference[oaicite:8]{index=8}
|
|
|
1 |
+
import httpx
|
|
|
|
|
2 |
from functools import lru_cache
|
3 |
+
|
4 |
+
_URL = "https://rest.ensembl.org/xrefs/symbol/homo_sapiens/{}?content-type=application/json"
|
5 |
+
|
6 |
@lru_cache(maxsize=512)
|
7 |
+
async def fetch_ensembl(sym: str):
|
8 |
async with httpx.AsyncClient(timeout=8) as c:
|
9 |
+
r = await c.get(_URL.format(sym))
|
10 |
+
return r.json()[0] if r.status_code == 200 and r.json() else {}
|
|