print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print("ERROR: failed SQL query:", domain, e)
+ print(f"ERROR: failed SQL query: domain='{domain}',exception:'{e}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
pending_errors[domain] = res
except BaseException as e:
- print("ERROR: failed SQL query:", domain, e)
+ print(f"ERROR: failed SQL query: domain='{domain}',exception:'{e}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print("ERROR: failed SQL query:", domain, e)
+ print(f"ERROR: failed SQL query: domain='{domain}',exception:'{e}'")
sys.exit(255)
connection.commit()
print(f"DEBUG: domain='{domain}' is misskey, sending API POST request ...")
counter = 0
- step = 99
+ step = config["misskey_offset"]
while True:
if counter == 0:
fetched = post_json_api(domain, "/api/federation/instances", json.dumps({
peers.append(row["host"])
# DEBUG: print("DEBUG: Returning peers[]:", type(peers))
- sys.exit(255)
return peers
elif software == "lemmy":
# DEBUG: print(f"DEBUG: domain='{domain}' is Lemmy, fetching JSON ...")
try:
res = reqto.get(f"https://{domain}{get_peers_url}", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
- # DEBUG: print("DEBUG: res.ok,res.json[]:", res.ok, type(res.json()))
+ # DEBUG: print(f"DEBUG: res.ok={res.ok},res.status_code={res.status_code},res.json[]={type(res.json())}")
if not res.ok or res.status_code >= 400:
res = reqto.get(f"https://{domain}/api/v3/site", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
# DEBUG: print("DEBUG: Returning peers[]:", type(peers))
return peers
-def post_json_api(domain: str, path: str, data: str) -> list:
- # DEBUG: print("DEBUG: Sending POST to domain,path,data:", domain, path, data)
+def post_json_api(domain: str, path: str, parameter: str) -> list:
+ print("DEBUG: Sending POST to domain,path,parameter:", domain, path, parameter)
data = {}
try:
- res = reqto.post(f"https://{domain}{path}", data=data, headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
+ res = reqto.post(f"https://{domain}{path}", data=parameter, headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
- # DEBUG: print("DEBUG: res.ok,res.json[]:", res.ok, type(res.json()))
+ print(f"DEBUG: res.ok={res.ok},res.status_code={res.status_code},res.json[]={type(res.json())}")
if not res.ok or res.status_code >= 400:
- print("WARNING: Cannot query JSON API:", domain, path, data, res.status_code)
+ print("WARNING: Cannot query JSON API:", domain, path, parameter, res.status_code)
update_last_error(domain, res)
else:
update_last_nodeinfo(domain)
data = res.json()
except BaseException as e:
- print("WARNING: Some error during post():", domain, path, data, e)
+ print("WARNING: Some error during post():", domain, path, parameter, e)
- # DEBUG: print("DEBUG: Returning data():", len(data))
+ print("DEBUG: Returning data():", len(data))
return data
def fetch_nodeinfo(domain: str) -> list:
# DEBUG: print("DEBUG: Fetching request:", request)
res = reqto.get(request, headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
- # DEBUG: print("DEBUG: res.ok,res.json[]:", res.ok, type(res.json()))
+ # DEBUG: print(f"DEBUG: res.ok={res.ok},res.status_code={res.status_code},res.json[]={type(res.json())}")
if res.ok and isinstance(res.json(), dict):
# DEBUG: print("DEBUG: Success:", request)
data = res.json()
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print("ERROR: failed SQL query:", reason, blocker, blocked, block_level, e)
+ print(f"ERROR: failed SQL query: reason='{reason}',blocker='{blocker}',blocked='{blocked}',block_level='{block_level}',sql='{sql}',exception:'{e}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
print("WARNING: Did not update any rows:", domain)
except BaseException as e:
- print("ERROR: failed SQL query:", last_seen, blocker, blocked, block_level, e)
+ print(f"ERROR: failed SQL query: last_seen='{last_seen}',blocker='{blocker}',blocked='{blocked}',block_level='{block_level}',exception:'{e}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
)
except BaseException as e:
- print("ERROR: failed SQL query:", blocker, blocked, reason, block_level, first_added, last_seen, e)
+ print(f"ERROR: failed SQL query: blocker='{blocker}',blocked='{blocked}',reason='{reason}',block_level='{block_level}',first_added='{first_added}',last_seen='{last_seen}',exception:'{e}'")
sys.exit(255)
# DEBUG: print("DEBUG: EXIT!")
# Check condition
registered = cursor.fetchone() != None
except BaseException as e:
- print("ERROR: failed SQL query:", blocker, blocked, reason, block_level, first_added, last_seen, e)
+ print(f"ERROR: failed SQL query: last_seen='{last_seen}'blocker='{blocker}',blocked='{blocked}',block_level='{block_level}',first_added='{first_added}',last_seen='{last_seen}',exception:'{e}'")
sys.exit(255)
# DEBUG: print("DEBUG: registered='{registered}' - EXIT!")
remove_pending_error(domain)
except BaseException as e:
- print("ERROR: failed SQL query:", domain, e)
+ print(f"ERROR: failed SQL query: domain='{domain}',exception:'{e}'")
sys.exit(255)
else:
# DEBUG: print("DEBUG: Updating nodeinfo for domain:", domain)
}
counter = 0
- step = 99
+ step = config["misskey_offset"]
while True:
# iterating through all "suspended" (follow-only in its terminology)
# instances page-by-page, since that troonware doesn't support