]> git.mxchange.org Git - fba.git/blobdiff - fba/networks/misskey.py
Continued:
[fba.git] / fba / networks / misskey.py
index b21db1ea524b282fce2e8e3e1cf498617f2089b1..045b5061c807fa4547802e26edcef8243e4b31b5 100644 (file)
@@ -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):
@@ -277,7 +288,10 @@ def fetch_blocks(domain: str) -> list:
                 blocked = tidyup.domain(instance["host"])
 
                 logger.debug("blocked='%s'", blocked)
-                if not domain_helper.is_wanted(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 "isBlocked" in instance and instance["isBlocked"] and not dict_helper.has_key(blocklist, "blocked", blocked):