From 3c6be18d6e2ba77a00f679ebcbb95d69c75e4dd2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 9 Mar 2024 21:16:10 +0100 Subject: [PATCH] Continued: - check 'json' key --- fba/commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fba/commands.py b/fba/commands.py index 08ff9ff..645f149 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -205,9 +205,12 @@ def fetch_bkali(args: argparse.Namespace) -> int: if "error_message" in fetched: logger.warning("post_json_api() for 'gql.sources.bka.li' returned error message='%s' - EXIT!", fetched["error_message"]) return 100 + elif "json" not in fetched: + logger.warning("post_json_api() returned fetched[]='%s' with missing 'json' element - EXIT!", type(fetched)) + return 101 elif isinstance(fetched["json"], dict) and "error" in fetched["json"] and "message" in fetched["json"]["error"]: logger.warning("post_json_api() returned error: '%s' - EXIT!", fetched["json"]["error"]["message"]) - return 101 + return 102 rows = fetched["json"] -- 2.39.5