_client = httpx.AsyncClient()
async def get_from_pypi(url: str) -> Optional[str]: # -> '1.8.0b1'
try:
req = await _client.get(url, timeout=5)
if req.status_code == 200:
return req.json().get("info", {}).get("version", None)
else:
return None
except Exception as e:
print(f"WARNING: Failed to check update from {url}", e)
return None