From: Roland Häder Date: Mon, 26 Jun 2023 21:56:06 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=80b2e509ae6d1481b8e749798d81d5c5cebd08ae;p=fba.git Continued: - response.headers.get("content-type") might be None and should be reported, too --- diff --git a/fba/http/network.py b/fba/http/network.py index a910afd..e323300 100644 --- a/fba/http/network.py +++ b/fba/http/network.py @@ -263,7 +263,7 @@ def json_from_response(response: requests.models.Response) -> list: logger.debug("response[]='%s' - CALLED!", type(response)) if not isinstance(response, requests.models.Response): raise ValueError(f"Parameter response[]='{type(response)}' is not type of 'Response'") - elif response.headers.get("content-type").split(";")[0] != "application/json": + elif response.headers.get("content-type") is None or response.headers.get("content-type").split(";")[0] != "application/json": logger.warning("response.headers[content-type]='%s' is not a JSON type, below json() invocation may raise an exception", response.headers.get("content-type")) data = list()