From: Roland Häder Date: Sat, 30 Sep 2023 21:54:51 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cf0d1c9f86fb8094fd3deb9edb19505307edc8d7;p=fba.git Continued: - added some more checks to avoid exceptions --- diff --git a/fba/networks/misskey.py b/fba/networks/misskey.py index b21db1e..7217b86 100644 --- a/fba/networks/misskey.py +++ b/fba/networks/misskey.py @@ -199,10 +199,21 @@ def fetch_blocks(domain: str) -> list: for instance in rows: # Is it there? logger.debug("instance[]='%s'", type(instance)) + if "host" not in instance: + logger.warning("instance(%d)='%s' has no key 'host' - SKIPPED!", len(instance), instance) + continue + elif instance["host"] is None or instance["host"] == "": + logger.debug("instance[host]='%s' is None or empty - SKIPPED!", instance["host"]) + continue + + logger.debug("instance[host]='%s' - BEFORE!", instance["host"]) blocked = tidyup.domain(instance["host"]) - logger.debug("blocked='%s'", blocked) - if not domain_helper.is_wanted(blocked): + logger.debug("blocked[%s]='%s' - AFTER!", type(blocked), blocked) + if blocked is None or blocked == "": + logger.warning("instance[host]='%s' is None or empty after tidyup.domain() - SKIPPED!", instance["host"]) + continue + elif not domain_helper.is_wanted(blocked): logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked) continue elif "isSuspended" in instance and instance["isSuspended"] and not dict_helper.has_key(blocklist, "blocked", blocked):