json = None
for request in requests:
- try:
- # NOISY-DEBUG: print("DEBUG: Fetching request:", request)
- res = reqto.get(request, headers=headers, timeout=5)
-
- # NOISY-DEBUG: print("DEBUG: res.ok,res.json[]:", res.ok, type(res.json()))
- if res.ok and res.json() is not None:
- # NOISY-DEBUG: print("DEBUG: Success:", request)
- json = res.json()
- break
- elif not res.ok or res.status_code >= 400:
- # NOISY-DEBUG: print("DEBUG: Failed fetching nodeinfo from domain:", domain)
- update_last_error(domain, res)
- continue
-
- except:
- print("WARNING: Some error during get():", request)
+ # NOISY-DEBUG: print("DEBUG: Fetching request:", request)
+ res = reqto.get(request, headers=headers, timeout=5)
+
+ # NOISY-DEBUG: print("DEBUG: res.ok,res.json[]:", res.ok, type(res.json()))
+ if res.ok and res.json() is not None:
+ # NOISY-DEBUG: print("DEBUG: Success:", request)
+ json = res.json()
+ break
+ elif not res.ok or res.status_code >= 400:
+ # NOISY-DEBUG: print("DEBUG: Failed fetching nodeinfo from domain:", domain)
+ update_last_error(domain, res)
+ continue
if json is None:
print("WARNING: Failed fetching nodeinfo from domain:", domain)
+ # NOISY-DEBUG: print("DEBUG: Updating last_nodeinfo for domain:", domain)
update_last_nodeinfo(domain)
# NOISY-DEBUG: print("DEBUG: Returning json():", len(json))
def determine_software(domain: str) -> str:
# NOISY-DEBUG: print("DEBUG: Determining software for domain:", domain)
software = None
- json = fetch_nodeinfo(domain)
- # NOISY-DEBUG: print("DEBUG: json():", len(json))
-
- if json["software"]["name"] in ["akkoma", "rebased"]:
- # NOISY-DEBUG: print("DEBUG: Setting pleroma:", domain, json["software"]["name"])
- software = "pleroma"
- elif json["software"]["name"] in ["hometown", "ecko"]:
- # NOISY-DEBUG: print("DEBUG: Setting mastodon:", domain, json["software"]["name"])
- software = "mastodon"
- elif json["software"]["name"] in ["calckey", "groundpolis", "foundkey", "cherrypick"]:
- # NOISY-DEBUG: print("DEBUG: Setting misskey:", domain, json["software"]["name"])
- software = "misskey"
- else:
- # NOISY-DEBUG: print("DEBUG: Using name:", domain, json["software"]["name"])
- software = json["software"]["name"]
+
+ try:
+ json = fetch_nodeinfo(domain)
+ # NOISY-DEBUG: print("DEBUG: json():", len(json))
+
+ if json["software"]["name"] in ["akkoma", "rebased"]:
+ # NOISY-DEBUG: print("DEBUG: Setting pleroma:", domain, json["software"]["name"])
+ software = "pleroma"
+ elif json["software"]["name"] in ["hometown", "ecko"]:
+ # NOISY-DEBUG: print("DEBUG: Setting mastodon:", domain, json["software"]["name"])
+ software = "mastodon"
+ elif json["software"]["name"] in ["calckey", "groundpolis", "foundkey", "cherrypick"]:
+ # NOISY-DEBUG: print("DEBUG: Setting misskey:", domain, json["software"]["name"])
+ software = "misskey"
+ else:
+ # NOISY-DEBUG: print("DEBUG: Using name:", domain, json["software"]["name"])
+ software = json["software"]["name"]
+
+ except:
+ print("WARNING: Could not determine software type:", domain)
# NOISY-DEBUG: print("DEBUG: Returning domain,software:", domain, software)
return software