From: Roland Häder Date: Thu, 18 May 2023 21:09:04 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0fd33131aa7d9719b5d34c30da5c1c6429a157a4;p=fba.git Continued: - you better should check an array on a specific key with `key in my_array` --- diff --git a/fetch_blocks.py b/fetch_blocks.py index 2ea4a86..6b0e060 100644 --- a/fetch_blocks.py +++ b/fetch_blocks.py @@ -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)