From c103c32738992ee6a946ec6ac8a71b4dacd52a9d Mon Sep 17 00:00:00 2001 From: Rafael Acevedo Date: Wed, 20 Mar 2024 17:30:35 -0300 Subject: [PATCH] Do not try to parse response to json when response is empty --- incognia/base_request.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/incognia/base_request.py b/incognia/base_request.py index 7d7d5d3..31f88bf 100644 --- a/incognia/base_request.py +++ b/incognia/base_request.py @@ -42,6 +42,8 @@ def post(self, url: Union[str, bytes], headers: Any = None, data: Any = None, timeout=self.__timeout, auth=auth) response.raise_for_status() + if len(response.content) == 0: + return None return json.loads(response.content.decode('utf-8')) or None except requests.HTTPError as e: