From 73389fa7d10ce6b5b1f167e36738bcb2a9c7578e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 22 May 2023 07:05:15 +0200 Subject: [PATCH] Continued: - proper place - also log status_code --- fba.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fba.py b/fba.py index 8a35af5..5b27c36 100644 --- a/fba.py +++ b/fba.py @@ -20,6 +20,13 @@ blacklist = [ "ngrok.io", ] +nodeinfos = [ + "http://nodeinfo.diaspora.software/ns/schema/2.1", + "http://nodeinfo.diaspora.software/ns/schema/2.0", + "http://nodeinfo.diaspora.software/ns/schema/1.1", + "http://nodeinfo.diaspora.software/ns/schema/1.0", +] + headers = { "user-agent": config["useragent"] } @@ -181,10 +188,10 @@ def fetch_wellknown_nodeinfo(domain: str) -> list: # NOISY-DEBUG: print("DEBUG: Found links in nodeinfo():", len(nodeinfo["links"])) for link in nodeinfo["links"]: # NOISY-DEBUG: print("DEBUG: rel,href:", link["rel"], link["href"]) - if link["rel"] in ["http://nodeinfo.diaspora.software/ns/schema/1.0", "http://nodeinfo.diaspora.software/ns/schema/1.1", "http://nodeinfo.diaspora.software/ns/schema/2.0", "http://nodeinfo.diaspora.software/ns/schema/2.1"]: + if link["rel"] in nodeinfos: # NOISY-DEBUG: print("DEBUG: Fetching nodeinfo from:", link["href"]) res = reqto.get(link["href"]) - # NOISY-DEBUG: print("DEBUG: href,res.ok:", link["href"], res.ok) + # NOISY-DEBUG: print("DEBUG: href,res.ok,res.status_code:", link["href"], res.ok, res.status_code) if res.ok and res.json() is not None: # NOISY-DEBUG: print("DEBUG: Found JSON nodeinfo():", len(res.json())) json = res.json() -- 2.39.5