From: Roland Häder Date: Wed, 24 May 2023 12:16:35 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c6d3579d3f6caa360f2f1a468f3d797400111ba1;p=fba.git Continued: - 'mode' must be used also for these elements --- diff --git a/fba.py b/fba.py index 6806d5e..1eeb75b 100644 --- a/fba.py +++ b/fba.py @@ -228,11 +228,11 @@ def get_peers(domain: str, software: str) -> list: # NOISY-DEBUG: print(f"DEBUG: Found {len(json['data'])} record(s).") for record in json["data"]: # NOISY-DEBUG: print(f"DEBUG: record()={len(record)}") - if "follower" in record and "host" in record["follower"]: - # NOISY-DEBUG: print(f"DEBUG: Found host={record['follower']['host']}, adding ...") - peers.append(record["follower"]["host"]) + if mode in record and "host" in record[mode]: + # NOISY-DEBUG: print(f"DEBUG: Found host={record[mode]['host']}, adding ...") + peers.append(record[mode]["host"]) else: - print(f"WARNING: record from '{domain}' has no 'follower' or 'host' record: {record}") + print(f"WARNING: record from '{domain}' has no '{mode}' or 'host' record: {record}") if len(json["data"]) < 100: # NOISY-DEBUG: print("DEBUG: Reached end of JSON response:", domain) @@ -241,8 +241,8 @@ def get_peers(domain: str, software: str) -> list: # Continue with next row start = start + 100 - except BaseException as e: - print("WARNING: Exception during fetching JSON:", domain, e) + except BaseException as e: + print("WARNING: Exception during fetching JSON:", domain, e) update_last_nodeinfo(domain)