From: Roland Häder Date: Fri, 4 Aug 2023 08:36:36 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f805d0aa59d7a536bcc613d130914d0e6e683bea;p=fba.git Continued: - ignore 'None' as content-type it often happens with Lemmy instannces --- diff --git a/fba/helpers/json.py b/fba/helpers/json.py index 4d5c846..5f3fa1a 100644 --- a/fba/helpers/json.py +++ b/fba/helpers/json.py @@ -26,7 +26,7 @@ def from_response(response: requests.models.Response) -> any: 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") is None or response.headers.get("content-type").split(";")[0] not in ["*/*", "application/json", "application/jrd+json", "application/activity+json"]: + elif response.headers.get("content-type") is not None and response.headers.get("content-type").split(";")[0] not in ["*/*", "application/json", "application/jrd+json", "application/activity+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()