message = "JSON response does not contain 'federated_instances' or 'error_message'"
print(f"WARNING: {message},domain='{domain}'")
instances.set_last_error(domain, message)
- else:
- # DEBUG: print("DEBUG: Querying API was successful:", domain, len(data))
+ elif isinstance(data["json"], list):
+ # DEBUG print("DEBUG: Querying API was successful:", domain, len(data['json']))
peers = data["json"]
+ else:
+ print(f"WARNING: Cannot parse data[json][]='{type(data['json'])}'")
# DEBUG: print(f"DEBUG: Adding '{len(peers)}' for domain='{domain}'")
instances.set_total_peers(domain, peers)
# DEBUG: print(f"DEBUG: row[]='{type(row)}' - EXIT!")
return row
-def set_last_blocked (domain: str):
+def set_last_blocked(domain: str):
# DEBUG: print(f"DEBUG: domain='{domain}' - CALLED!")
if not isinstance(domain, str):
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
_set_data("last_blocked", domain, time.time())
# DEBUG: print("DEBUG: EXIT!")
-def set_last_instance_fetch (domain: str):
+def set_last_instance_fetch(domain: str):
# DEBUG: print(f"DEBUG: domain='{domain}' - CALLED!")
if not isinstance(domain, str):
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
_set_data("last_instance_fetch", domain, time.time())
# DEBUG: print("DEBUG: EXIT!")
-def set_total_peers (domain: str, peers: list):
+def set_total_peers(domain: str, peers: list):
# DEBUG: print(f"DEBUG: domain='{domain}',peers()={len(peers)} - CALLED!")
if not isinstance(domain, str):
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
elif domain == "":
raise ValueError("Parameter 'domain' is empty")
elif not isinstance(peers, list):
- raise ValueError("Parameter peers[]='{type(peers)}' is not 'list'")
+ raise ValueError(f"Parameter peers[]='{type(peers)}' is not 'list'")
# Set timestamp
_set_data("total_peers", domain, len(peers))
# DEBUG: print("DEBUG: EXIT!")
-def set_nodeinfo_url (domain: str, url: list):
+def set_nodeinfo_url(domain: str, url: list):
# DEBUG: print(f"DEBUG: domain='{domain}',url='{url}' - CALLED!")
if not isinstance(domain, str):
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
_set_data("nodeinfo_url", domain, url)
# DEBUG: print("DEBUG: EXIT!")
-def set_detection_mode (domain: str, url: list):
+def set_detection_mode(domain: str, url: list):
# DEBUG: print(f"DEBUG: domain='{domain}',url='{url}' - CALLED!")
if not isinstance(domain, str):
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
_set_data("detection_mode", domain, url)
# DEBUG: print("DEBUG: EXIT!")
-def set_detection_mode (domain: str, url: list):
+def set_detection_mode(domain: str, url: list):
# DEBUG: print(f"DEBUG: domain='{domain}',url='{url}' - CALLED!")
if not isinstance(domain, str):
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
_set_data("detection_mode", domain, url)
# DEBUG: print("DEBUG: EXIT!")
-def set_detection_mode (domain: str, mode: list):
+def set_detection_mode(domain: str, mode: list):
# DEBUG: print(f"DEBUG: domain='{domain}',mode='{mode}' - CALLED!")
if not isinstance(domain, str):
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")