From: Roland Häder Date: Sat, 2 Dec 2023 14:48:22 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=adf9456ecab40aa5775ceb39fe478384d47ef064;p=fba.git Continued: - check blacklist and skip below code - also handle "error" (int) and "msg" (string) JSON response --- diff --git a/fba/commands.py b/fba/commands.py index c7361ed..97b43cf 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1281,6 +1281,9 @@ def recheck_obfuscation(args: argparse.Namespace) -> int: if (args.force is None or not args.force) and args.domain is None and args.software is None and instances.is_recent(row["domain"], "last_blocked"): logger.debug("row[domain]='%s' has been recently checked, args.force[]='%s' - SKIPPED!", row["domain"], type(args.force)) continue + elif blacklist.is_blacklisted(row["domain"]): + logger.warning("row[domain]='%s' is blacklisted - SKIPPED!", row["domain"]) + continue logger.debug("Invoking federation.fetch_blocks(%s) ...", row["domain"]) blocking = federation.fetch_blocks(row["domain"]) diff --git a/fba/models/instances.py b/fba/models/instances.py index 3626013..67a5c16 100644 --- a/fba/models/instances.py +++ b/fba/models/instances.py @@ -273,6 +273,10 @@ def set_last_error(domain: str, error: dict): logger.debug("Setting last_error_details='%s' (error_message)", error['error_message']) _set_data("last_status_code" , domain, error["status_code"]) _set_data("last_error_details", domain, error["error_message"] if error["error_message"] != "" else None) + elif "json" in error and "error" in error["json"] and "msg" in error["json"]: + logger.debug("Setting last_error_details='%s' (json,error)", error["json"]["msg"]) + _set_data("last_status_code" , domain, error["status_code"]) + _set_data("last_error_details", domain, error["json"]["msg"] if error["json"]["msg"] != "" else None) elif "json" in error and "error" in error["json"] and "message" in error["json"]["error"]: logger.debug("Setting last_error_details='%s' (json,error)", error["json"]["error"]["message"]) _set_data("last_status_code" , domain, error["status_code"])