logger.debug("Invoking locking.acquire() ...")
locking.acquire()
+ # Init variables
+ rows = list()
+
# Is domain or software set?
if args.domain != "":
logger.debug("args.domain='%s' - checking ...", args.domain)
# Fetch record
database.cursor.execute("SELECT domain, origin, software FROM instances WHERE domain = ? LIMIT 1", [domain])
+ rows = database.cursor.fetchall()
- rows = database.cursor.fetchall()
logger.info("Checking %d entries ...", len(rows))
for row in rows:
logger.debug("row[domain]='%s',row[origin]='%s',row[software]='%s'", row["domain"], row["origin"], row["software"])
elif len(rows) == 0:
raise ValueError("Parameter 'rows' is empty")
+ # Init variables
peers = list()
+
for key in ["linked", "allowed", "blocked"]:
logger.debug("key='%s'", key)
if key not in rows or rows[key] is None:
continue
elif isinstance(peer, dict) and "domain" in peer:
logger.debug("peer[domain]='%s'", peer["domain"])
- peer = tidyup.domain(peer["domain"])
+ peer = tidyup.domain(peer["domain"]) if peer["domain"] != "" else None
elif isinstance(peer, str):
logger.debug("peer='%s'", peer)
peer = tidyup.domain(peer)
elif not instances.is_registered(domain):
raise Exception(f"domain='{domain}' is not registered but function is invoked.")
- logger.info("Fetching mastodon blocks from domain='%s'", domain)
+ # Init variables
doc = None
+
+ logger.info("Fetching mastodon blocks from domain='%s'", domain)
for path in ["/about/more", "/about"]:
try:
logger.debug("Fetching path='%s' from domain='%s' ...", path, domain)
elif not instances.is_registered(domain):
raise Exception(f"domain='{domain}' is not registered but function is invoked.")
+ # Init variables
blocklist = list()
logger.debug("Invoking fetch_blocks_from_about(%s) ...", domain)
elif not instances.is_registered(domain):
raise Exception(f"domain='{domain}' is not registered but function is invoked.")
+ # Init variables
blockdict = list()
rows = None
else:
logger.warning("Cannot find 'mrf_simple_info' or 'quarantined_instances_info' in JSON reply: domain='%s'", domain)
+ logger.debug("found='%s'", found)
if not found:
logger.debug("Did not find any useable JSON elements, domain='%s', continuing with /about page ...", domain)
blocklist = fetch_blocks_from_about(domain)
elif not instances.is_registered(domain):
raise Exception(f"domain='{domain}' is not registered but function is invoked.")
- logger.debug("Fetching mastodon blocks from domain='%s'", domain)
+ # Init variables
doc = None
+
+ logger.debug("Fetching mastodon blocks from domain='%s'", domain)
for path in ["/instance/about/index.html"]:
try:
# Resetting doc type
blocked = line.find_all("td")[0].text
reason = line.find_all("td")[1].text
- logger.debug("blocked='%s',reason='%s'", blocked, reason)
+ logger.debug("blocked='%s',reason='%s' - BEFORE!", blocked, reason)
blocked = tidyup.domain(blocked) if blocked != "" else None
- reason = tidyup.reason(reason) if reason != "" else None
+ reason = tidyup.reason(reason) if reason != "" else None
logger.debug("blocked='%s',reason='%s' - AFTER!", blocked, reason)
if blocked in [None, ""]: