From c6d3579d3f6caa360f2f1a468f3d797400111ba1 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Wed, 24 May 2023 14:16:35 +0200
Subject: [PATCH] Continued: - 'mode' must be used also for these elements

---
 fba.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

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