From c43acd50f4469d008b4f1f47485c7f05ddd7de31 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 29 Mar 2021 11:35:54 +0200 Subject: [PATCH] Updater check response code (#2766) * Updater check response code * use newstyle timeout --- supervisor/updater.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/supervisor/updater.py b/supervisor/updater.py index 89b500a6d..1003ff282 100644 --- a/supervisor/updater.py +++ b/supervisor/updater.py @@ -189,7 +189,13 @@ class Updater(FileConfiguration, CoreSysAttributes): # Get data try: _LOGGER.info("Fetching update data from %s", url) - async with self.sys_websession.get(url, timeout=10) as request: + timeout = aiohttp.ClientTimeout(total=10) + async with self.sys_websession.get(url, timeout=timeout) as request: + if request.status != 200: + raise UpdaterError( + f"Fetching version from {url} response with {request.status}", + _LOGGER.warning, + ) data = await request.read() except (aiohttp.ClientError, asyncio.TimeoutError) as err: