]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 22 May 2023 02:58:41 +0000 (04:58 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 22 May 2023 02:58:41 +0000 (04:58 +0200)
- first try auto-discovery, then static list

fba.py

diff --git a/fba.py b/fba.py
index 4e74fd8f8697b6b979ea6ec3476857aa70b03938..852795df8f3826c64baa9fb26adb79a9be62454d 100644 (file)
--- a/fba.py
+++ b/fba.py
@@ -124,6 +124,13 @@ def post_json_api(domain: str, path: str, data: str) -> list:
 def fetch_nodeinfo(domain: str) -> list:
     # NOISY-DEBUG: print("DEBUG: Fetching nodeinfo from domain:", domain)
 
+    nodeinfo = fetch_wellknown_nodeinfo(domain)
+    # NOISY-DEBUG: print("DEBUG: nodeinfo:", len(nodeinfo))
+
+    if len(nodeinfo) > 0:
+        # NOISY-DEBUG: print("DEBUG: Returning auto-discovered nodeinfo:", len(nodeinfo))
+        return nodeinfo
+
     requests = [
        f"https://{domain}/nodeinfo/2.1.json",
        f"https://{domain}/nodeinfo/2.1",
@@ -156,7 +163,6 @@ def fetch_nodeinfo(domain: str) -> list:
     # NOISY-DEBUG: print("DEBUG: json[]:", type(json))
     if json is None or len(json) == 0:
         print("WARNING: Failed fetching nodeinfo from domain:", domain)
-        json = fetch_wellknown_nodeinfo(domain)
 
     # NOISY-DEBUG: print("DEBUG: Returning json[]:", type(json))
     return json