for entry in fetched["data"]["nodeinfo"]:
# DEBUG: print(f"DEBUG: entry['{type(entry)}']='{entry}'")
if not "domain" in entry:
- print(f"WARNING: entry does not contain 'domain' - SKIPPED!")
+ print(f"WARNING: entry()={len(entry)} does not contain 'domain' - SKIPPED!")
continue
elif not validators.domain(entry["domain"]):
print(f"WARNING: domain='{entry['domain']}' is not a valid domain - SKIPPED!")
# DEBUG: print(f"DEBUG: Adding domain='{entry['domain']}' ...")
domains.append(entry["domain"])
- except BaseException as e:
- print(f"ERROR: Cannot fetch graphql,exception[{type(e)}]:'{str(e)}'")
+ except BaseException as exception:
+ print(f"ERROR: Cannot fetch graphql,exception[{type(exception)}]:'{str(exception)}'")
sys.exit(255)
# DEBUG: print(f"DEBUG: domains()={len(domains)}")
def fetch_blocks(args: argparse.Namespace):
# DEBUG: print(f"DEBUG: args[]={type(args)} - CALLED!")
- if args.domain != None and args.domain != "":
+ if args.domain is not None and args.domain != "":
# DEBUG: print(f"DEBUG: args.domain='{args.domain}' - checking ...")
if not validators.domain(args.domain):
print(f"WARNING: domain='{args.domain}' is not valid.")
boot.acquire_lock()
- if args.domain != None and args.domain != "":
+ if args.domain is not None and args.domain != "":
# Re-check single domain
fba.cursor.execute(
"SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'bookwyrm', 'takahe') AND domain = ?", [args.domain]
blocked, reason = block.values()
# DEBUG: print(f"DEBUG: blocked='{blocked}',reason='{reason}' - BEFORE!")
blocked = fba.tidyup_domain(blocked)
- reason = fba.tidyup_reason(reason) if reason != None and reason != "" else None
+ reason = fba.tidyup_reason(reason) if reason is not None and reason != "" else None
# DEBUG: print(f"DEBUG: blocked='{blocked}',reason='{reason}' - AFTER!")
if blocked == "":
searchres = fba.cursor.fetchone()
- if searchres == None:
+ if searchres is None:
print(f"WARNING: Cannot deobsfucate blocked='{blocked}' - SKIPPED!")
continue
searchres = fba.cursor.fetchone()
- if searchres == None:
+ if searchres is None:
print(f"WARNING: Cannot deobsfucate blocked='{blocked}' - SKIPPED!")
continue
# DEBUG: print("DEBUG: Committing changes ...")
fba.connection.commit()
- except Exception as e:
- print(f"ERROR: blocker='{blocker}',software='{software}',exception[{type(e)}]:'{str(e)}'")
+ except Exception as exception:
+ print(f"ERROR: blocker='{blocker}',software='{software}',exception[{type(exception)}]:'{str(exception)}'")
else:
print("WARNING: Unknown software:", blocker, software)
# DEBUG: print(f"DEBUG: blocked[]={type(blocked)}")
domains["reject"] = domains["reject"] + fba.find_domains(blocked)
- except BaseException as e:
- print(f"ERROR: Cannot fetch from meta.chaos.social,exception[{type(e)}]:'{str(e)}'")
+ except BaseException as exception:
+ print(f"ERROR: Cannot fetch from meta.chaos.social,exception[{type(exception)}]:'{str(exception)}'")
sys.exit(255)
# DEBUG: print(f"DEBUG: domains()={len(domains)}")
# DEBUG: print(f"DEBUG: Adding domain='{domain}'")
domains.append(domain)
- except BaseException as e:
- print(f"ERROR: Cannot fetch feed='{feed}',exception[{type(e)}]:'{str(e)}'")
+ except BaseException as exception:
+ print(f"ERROR: Cannot fetch feed='{feed}',exception[{type(exception)}]:'{str(exception)}'")
sys.exit(255)
# DEBUG: print(f"DEBUG: domains()={len(domains)}")
# DEBUG: print(f"DEBUG: Adding domain='{domain}',domains()={len(domains)}")
domains.append(domain)
- except BaseException as e:
- print(f"ERROR: Cannot fetch feed='{feed}',exception[{type(e)}]:'{str(e)}'")
+ except BaseException as exception:
+ print(f"ERROR: Cannot fetch feed='{feed}',exception[{type(exception)}]:'{str(exception)}'")
sys.exit(255)
# DEBUG: print(f"DEBUG: domains({len(domains)})={domains}")