]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 8 Sep 2024 00:16:26 +0000 (02:16 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 8 Sep 2024 00:16:26 +0000 (02:16 +0200)
- check if instance[host] is at least set and a non-empty string

fba/networks/misskey.py

index 5d71e5894bf0a909a943759332f07f4e55eb0a97..cf8849d07e2ab1f936296e012792f9fe34f05059 100644 (file)
@@ -297,6 +297,17 @@ def fetch_blocks(domain: str) -> list:
             for instance in rows:
                 # Is it there?
                 logger.debug("instance[]='%s'", type(instance))
+                if not isinstance(instance, dict):
+                    logger.warning("instance[]='%s' is not of type 'dict' - SKIPPED!", type(instance))
+                    continue
+                elif not "host" in instance:
+                    logger.warning("instance()=%d has no element 'host' - SKIPPED!", len(instance))
+                    continue
+                elif not isinstance(instance["host"], str):
+                    logger.warning("instance[host][]='%s' is not of type 'str' - SKIPPED!", type(instance["host"]))
+                    continue
+
+                logger.debug("instance[host]='%s' - BEFORE!", instance["host"])
                 blocked = tidyup.domain(instance["host"]) if instance["host"] != "" else None
                 logger.debug("blocked='%s' - AFTER!", blocked)