+ try:
+ print(f"INFO: Fetching instances for instance '{row[0]}' ('{row[2]}') of origin='{row[1]}',nodeinfo_url='{row[3]}'")
+ federation.fetch_instances(row[0], row[1], row[2], inspect.currentframe().f_code.co_name, row[3])
+ except network.exceptions as exception:
+ print(f"WARNING: Exception '{type(exception)}' during fetching instances from domain='{row[0]}'")
+ instances.update_last_error(row[0], exception)
+
+ # DEBUG: print("DEBUG: EXIT!")
+
+def fetch_federater(args: argparse.Namespace):
+ # DEBUG: print(f"DEBUG: args[]='{type(args)}' - CALLED!")
+ locking.acquire()
+
+ # Fetch this URL
+ response = fba.fetch_url("https://github.com/federater/blocks_recommended/raw/main/federater.csv", network.web_headers, (config.get("connection_timeout"), config.get("read_timeout")))
+ # DEBUG: print(f"DEBUG: response[]='{type(response)}'")
+ if response.ok and response.content != "":
+ # DEBUG: print(f"DEBUG: Fetched {len(response.content)} Bytes, parsing CSV ...")
+ ## DEBUG: print(f"DEBUG: response.content={response.content}")
+ reader = csv.DictReader(response.content.decode('utf-8').splitlines(), dialect='unix')
+ #, fieldnames='domain,severity,reject_media,reject_reports,public_comment,obfuscate'
+ # DEBUG: print(f"DEBUG: reader[]='{type(reader)}'")
+ for row in reader:
+ if not validators.domain(row["#domain"]):
+ print(f"WARNING: domain='{row['#domain']}' is not a valid domain - skipped!")
+ continue
+ elif blacklist.is_blacklisted(row["#domain"]):
+ print(f"WARNING: domain='{row['#domain']}' is blacklisted - skipped!")
+ continue
+ elif instances.is_registered(row["#domain"]):
+ # DEBUG: print(f"DEBUG: domain='{row['#domain']}' is already registered - skipped!")
+ continue
+
+ try:
+ print(f"INFO: Fetching instances for instane='{row['#domain']}' ...")
+ federation.fetch_instances(row["#domain"], None, None, inspect.currentframe().f_code.co_name)
+ except network.exceptions as exception:
+ print(f"WARNING: Exception '{type(exception)}' during fetching instances from domain='{row['#domain']}'")
+ instances.update_last_error(row["#domain"], exception)