From 91733b5be864d8a42fafbf7c4056401d61b0acc8 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 29 Nov 2024 10:45:49 +0300 Subject: [PATCH] A try to fix JSONDecodeError for simplejson --- reportportal_client/core/rp_responses.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/reportportal_client/core/rp_responses.py b/reportportal_client/core/rp_responses.py index b017db8..53063a9 100644 --- a/reportportal_client/core/rp_responses.py +++ b/reportportal_client/core/rp_responses.py @@ -19,7 +19,6 @@ """ import logging -from json import JSONDecodeError from typing import Any, Optional, Generator, Mapping, Tuple, Union from aiohttp import ClientResponse @@ -88,7 +87,7 @@ def json(self) -> Any: if self.__json is NOT_SET: try: self.__json = self._resp.json() - except (JSONDecodeError, TypeError) as exc: + except (ValueError, TypeError) as exc: logger.error(_get_json_decode_error_message(self._resp), exc_info=exc) self.__json = None return self.__json @@ -156,7 +155,7 @@ async def json(self) -> Any: if self.__json is NOT_SET: try: self.__json = await self._resp.json() - except (JSONDecodeError, TypeError) as exc: + except (ValueError, TypeError) as exc: logger.error(_get_json_decode_error_message(self._resp), exc_info=exc) self.__json = None return self.__json