From: Roland Häder Date: Thu, 19 Sep 2024 17:24:02 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b9f4223fd2e51af9110f584d63ee61f2c27c8205;p=fba.git Continued: - an empty string is not the same as None, that's correct. So both need to be checked - yes, first I check on false (missing keys, etc.) then true (positive outcome) --- diff --git a/fba/http/network.py b/fba/http/network.py index c982f61..6860001 100644 --- a/fba/http/network.py +++ b/fba/http/network.py @@ -388,8 +388,8 @@ def fetch_json_rows(hostname: str, path: str, headers: dict = {}, rows_key: str return list() elif "json" not in fetched: raise KeyError("fetched has no element 'json'") - elif rows_key != "" and rows_key not in fetched["json"]: - raise KeyError("fetched[row] has no element '{rows_key}'") + elif rows_key not in[None, ""] and rows_key not in fetched["json"]: + raise KeyError(f"fetched[row] has no element '{rows_key}'") elif rows_key == None: logger.debug("Parameter 'rows_key' is not set, using whole fetched['json'] as rows ...") rows = fetched["json"]