]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 23 Jun 2023 04:33:13 +0000 (06:33 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 23 Jun 2023 04:33:13 +0000 (06:33 +0200)
- used more `foo in ['some', 'other']`

fba/http/federation.py
fba/models/instances.py

index a27bedcac37ea8f8514c6004eb7611126ce6060b..ad2495992b2943cb046f71b661bdc7703278606c 100644 (file)
@@ -222,10 +222,14 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict:
     ]
 
     for request in request_paths:
-        logger.debug("path[%s]='%s',request='%s'", type(path), path, request)
-        if path is None or path == request or path == f"http://{domain}{path}" or path == f"https://{domain}{path}":
+        logger.debug("request='%s'", request)
+        http_url  = f"http://{domain}{path}"
+        https_url = f"https://{domain}{path}"
+
+        logger.debug("path[%s]='%s',request='%s',http_url='%s',https_url='%s'", type(path), path, request, http_url, https_url)
+        if path is None or path in [request, http_url, https_url]:
             logger.debug("Fetching request='%s' from domain='%s' ...", request, domain)
-            if path in [f"http://{domain}{path}", f"https://{domain}{path}"]:
+            if path in [http_url, https_url]:
                 logger.debug("domain='%s',path='%s' has protocol in path, splitting ...", domain, path)
                 components = urlparse(path)
                 path = components.path
@@ -238,7 +242,7 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict:
             )
 
             logger.debug("data[]='%s'", type(data))
-            if "error_message" not in data:
+            if "error_message" not in data and "json" in data:
                 logger.debug("Success: request='%s'", request)
                 instances.set_detection_mode(domain, "STATIC_CHECK")
                 instances.set_nodeinfo_url(domain, request)
index fe2c1b08bbd77a71423db32466560351fba0525e..3ba561f81425553a30b608f12d60d5600b64d8b2 100644 (file)
@@ -41,7 +41,7 @@ logger = logging.getLogger(__name__)
 # written to database. Both arrays must be filled at the same time or else
 # update_data() will fail
 _pending = {
-    # Detection mode: 'AUTO_DISCOVERY', 'STATIC_CHECKS' or 'GENERATOR'
+    # Detection mode
     # NULL means all detection methods have failed (maybe still reachable instance)
     "detection_mode"     : {},
     # Found nodeinfo URL