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)
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)