From: Roland Häder Date: Mon, 22 May 2023 02:58:41 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0309071eb64a35a9c7bd600aaee325f9ad4d7108;p=fba.git Continued: - first try auto-discovery, then static list --- diff --git a/fba.py b/fba.py index 4e74fd8..852795d 100644 --- 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