import httpx from functools import lru_cache _URL = "https://www.ebi.ac.uk/gxa/json/expressionSummary?geneQuery={}" @lru_cache(maxsize=512) async def fetch_expression(sym: str): async with httpx.AsyncClient(timeout=10) as c: r = await c.get(_URL.format(sym)) return r.json() if r.status_code == 200 else {}