sys.exit(255)
def update_last_error(domain: str, res: any):
- # NOISY-DEBUG: print("DEBUG: domain,res.status_code", domain, res.status_code)
-
+ # NOISY-DEBUG: print("DEBUG: domain,res.status_code:", domain, res.status_code, res.reason)
try:
c.execute("UPDATE instances SET last_status_code = ?, last_error_details = ?, last_updated = ? WHERE domain = ?", [
res.status_code,
- res.text,
+ res.reason,
time.time(),
domain
])
def update_last_nodeinfo(domain: str):
# NOISY-DEBUG: print("DEBUG: Updating last_nodeinfo for domain:", domain)
-
try:
c.execute("UPDATE instances SET last_nodeinfo = ?, last_updated = ? WHERE domain = ?", [
time.time(),
return peers
def post_json_api(domain: str, path: str, data: str) -> list:
+ # NOISY-DEBUG: print("DEBUG: Sending POST to domain,path,data:", domain, path, data)
try:
- # NOISY-DEBUG: print("DEBUG: Sending POST to domain,path,data:", domain, path, data)
res = reqto.post(f"https://{domain}{path}", data=data, headers=headers, timeout=config["timeout"])
if not res.ok or res.status_code >= 400:
# Loop through some instances
fba.c.execute(
- "SELECT domain FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial') AND (software IS NULL OR last_nodeinfo IS NULL OR last_nodeinfo < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_instance"]]
+ "SELECT domain FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial') AND (last_nodeinfo IS NULL OR last_nodeinfo < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_instance"]]
)
for instance in fba.c.fetchall():