From 22cfceb7f65d45de6902b902acb4ac360bf7d5da Mon Sep 17 00:00:00 2001 From: Charles Garwood Date: Mon, 4 Oct 2021 15:20:41 -0400 Subject: [PATCH] Fix content type checking for FKB 1.44+ (#11) --- fullykiosk/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fullykiosk/__init__.py b/fullykiosk/__init__.py index 412dd9a..ce228a4 100644 --- a/fullykiosk/__init__.py +++ b/fullykiosk/__init__.py @@ -142,6 +142,10 @@ async def get(self, **kwargs): ) raise FullyKioskError(response.status, await response.text()) - data = await response.json(content_type="text/html") + try: + data = await response.json() + except aiohttp.client_exceptions.ContentTypeError: + data = await response.json(content_type="text/html") + _LOGGER.debug(json.dumps(data)) return data