From: Roland Häder Date: Sat, 10 Jun 2023 14:38:05 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8701b98a678cb4c2827611b4c138d05514613474;p=fba.git Continued: - data['json'] now contains the reply --- diff --git a/fba/federation.py b/fba/federation.py index 8d5515e..2a834b6 100644 --- a/fba/federation.py +++ b/fba/federation.py @@ -333,27 +333,27 @@ def determine_software(domain: str, path: str = None) -> str: data = fetch_nodeinfo(domain, path) # DEBUG: print("DEBUG: data[]:", type(data)) - if not isinstance(data, dict) or len(data) == 0: + if "error_message" in data: # DEBUG: print("DEBUG: Could not determine software type:", domain) return fetch_generator_from_path(domain) # DEBUG: print("DEBUG: data():", len(data), data) - if "status" in data and data["status"] == "error" and "message" in data: - print("WARNING: JSON response is an error:", data["message"]) - instances.update_last_error(domain, data["message"]) + if "status" in data["json"] and data["json"]["status"] == "error" and "message" in data["json"]: + print("WARNING: JSON response is an error:", data["json"]["message"]) + instances.update_last_error(domain, data["json"]["message"]) return fetch_generator_from_path(domain) - elif "message" in data: + elif "message" in data["json"]: print("WARNING: JSON response contains only a message:", data["message"]) - instances.update_last_error(domain, data["message"]) + instances.update_last_error(domain, data["json"]["message"]) return fetch_generator_from_path(domain) - elif "software" not in data or "name" not in data["software"]: + elif "software" not in data["json"] or "name" not in data["json"]["software"]: # DEBUG: print(f"DEBUG: JSON response from domain='{domain}' does not include [software][name], fetching / ...") software = fetch_generator_from_path(domain) # DEBUG: print(f"DEBUG: Generator for domain='{domain}' is: {software}, EXIT!") return software - software = tidyup.domain(data["software"]["name"]) + software = tidyup.domain(data["json"]["software"]["name"]) # DEBUG: print("DEBUG: sofware after tidyup.domain():", software) if software in ["akkoma", "rebased"]: