]> git.mxchange.org Git - fba.git/blobdiff - fetch_blocks.py
Continued:
[fba.git] / fetch_blocks.py
index 2ea4a8662a30380da72e189153d77556a6881207..6b0e060e05dcac8adabf17215fd0c4d603ee300b 100644 (file)
@@ -26,12 +26,13 @@ for blocker, software in fba.c.fetchall():
             federation = reqto.get(
                 f"https://{blocker}/nodeinfo/2.1.json", headers=fba.headers, timeout=5
             ).json()["metadata"]["federation"]
+
             if "mrf_simple" in federation:
                 for block_level, blocks in (
                     {**federation["mrf_simple"],
                     **{"quarantined_instances": federation["quarantined_instances"]}}
                 ).items():
-                    # NOISY-DEBUG: print("DEBUG: block_level, blocks.items():", block_level, len(blocks.items()))
+                    # NOISY-DEBUG: print("DEBUG: block_level, blocks():", block_level, len(blocks))
                     block_level = fba.tidyup(block_level)
                     # NOISY-DEBUG: print("DEBUG: BEFORE block_level:", block_level)
 
@@ -348,13 +349,10 @@ for blocker, software in fba.c.fetchall():
 
             if (federation == None):
                 print("WARNING: No valid response:", blocker);
+            elif "error" in federation:
+                print("WARNING: API returned error:", federation["error"])
             else:
                 for peer in federation:
-                    # NOISY-DEBUG: print("DEBUG: peer(),[]:", len(peer), type(peer))
-                    if (isinstance(peer, str) and peer == "error"):
-                        print("WARNING: Cannot continue, maybe authentication required?", blocker)
-                        break
-
                     blocked = peer["domain"].lower()
                     # NOISY-DEBUG: print("DEBUG: BEFORE-blocked:", blocked)
                     blocked = fba.tidyup(blocked)