conn = sqlite3.connect("blocks.db")
c = conn.cursor()
+def is_blacklisted(domain: str) -> bool:
+ # NOISY-DEBUG: print("DEBUG: Checking blacklist for domain:", domain)
+ blacklisted = False
+ for peer in blacklist:
+ # NOISY-DEBUG: print("DEBUG: domain,peer:", domain, peer)
+ if peer in domain:
+ blacklisted = True
+
+ # NOISY-DEBUG: print("DEBUG: blacklisted:", blacklisted)
+ return blacklisted
+
def get_hash(domain: str) -> str:
# NOISY-DEBUG: print("DEBUG: Calculating hash for domain:", domain)
return sha256(domain.encode("utf-8")).hexdigest()
# NOISY-DEBUG: print("DEBUG: domain,res.status_code", domain, res.status_code)
try:
- c.execute("UPDATE instances SET last_status_code = ?, last_updated = ? WHERE domain = ?", [
+ c.execute("UPDATE instances SET last_status_code = ?, last_error_details = ?, last_updated = ? WHERE domain = ?", [
res.status_code,
+ res.text,
time.time(),
domain
])