Use aiohttp.ClientTimeout for timeout (#122458)

This commit is contained in:
Marc Mueller
2024-07-23 15:20:04 +02:00
committed by GitHub
parent 545514c5cd
commit 156a2427ff
8 changed files with 18 additions and 8 deletions

View File

@@ -163,7 +163,8 @@ async def _get_whoami(session: aiohttp.ClientSession) -> dict[str, Any] | None:
"""Query whoami.home-assistant.io for location data."""
try:
resp = await session.get(
WHOAMI_URL_DEV if HA_VERSION.endswith("0.dev0") else WHOAMI_URL, timeout=30
WHOAMI_URL_DEV if HA_VERSION.endswith("0.dev0") else WHOAMI_URL,
timeout=aiohttp.ClientTimeout(total=30),
)
except (aiohttp.ClientError, TimeoutError):
return None