]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 24 May 2023 12:16:35 +0000 (14:16 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 24 May 2023 12:16:35 +0000 (14:16 +0200)
- 'mode' must be used also for these elements

fba.py

diff --git a/fba.py b/fba.py
index 6806d5e5e2ee6ed7a350eacdd3e35408caa6db15..1eeb75bad23861a0b46b7b3a9f4f6801e7babf6e 100644 (file)
--- 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)