]> git.mxchange.org Git - fba.git/blobdiff - fba/networks/pleroma.py
Continued/WIP:
[fba.git] / fba / networks / pleroma.py
index 6ee00a6b83ab428f99f66dfcbbf5416484ec0cb3..4126999e8f08ea466980b4cfa3b5bd2cb1dc6f9a 100644 (file)
@@ -61,6 +61,7 @@ def fetch_blocks(domain: str) -> list:
     elif not instances.is_registered(domain):
         raise Exception(f"domain='{domain}' is not registered but function is invoked.")
 
+    # Init variables
     blockdict = list()
     rows = None
 
@@ -269,6 +270,7 @@ def fetch_blocks(domain: str) -> list:
     else:
         logger.warning("Cannot find 'mrf_simple_info' or 'quarantined_instances_info' in JSON reply: domain='%s'", domain)
 
+    logger.debug("found='%s'", found)
     if not found:
         logger.debug("Did not find any useable JSON elements, domain='%s', continuing with /about page ...", domain)
         blocklist = fetch_blocks_from_about(domain)
@@ -299,8 +301,10 @@ def fetch_blocks_from_about(domain: str) -> dict:
     elif not instances.is_registered(domain):
         raise Exception(f"domain='{domain}' is not registered but function is invoked.")
 
-    logger.debug("Fetching mastodon blocks from domain='%s'", domain)
+    # Init variables
     doc = None
+
+    logger.debug("Fetching mastodon blocks from domain='%s'", domain)
     for path in ["/instance/about/index.html"]:
         try:
             # Resetting doc type
@@ -378,9 +382,9 @@ def fetch_blocks_from_about(domain: str) -> dict:
                 blocked = line.find_all("td")[0].text
                 reason  = line.find_all("td")[1].text
 
-                logger.debug("blocked='%s',reason='%s'", blocked, reason)
+                logger.debug("blocked='%s',reason='%s' - BEFORE!", blocked, reason)
                 blocked = tidyup.domain(blocked) if blocked != "" else None
-                reason = tidyup.reason(reason) if reason != "" else None
+                reason  = tidyup.reason(reason)  if reason  != "" else None
                 logger.debug("blocked='%s',reason='%s' - AFTER!", blocked, reason)
 
                 if blocked in [None, ""]: