]> git.mxchange.org Git - fba.git/blobdiff - fba.py
Continued:
[fba.git] / fba.py
diff --git a/fba.py b/fba.py
index 0d467b05cb6363ff92168c5ae07d90af253e91c6..93a5de867ef99b8c5b889e432541d834bb05c62a 100644 (file)
--- a/fba.py
+++ b/fba.py
@@ -27,6 +27,17 @@ headers = {
 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()
@@ -49,8 +60,9 @@ def update_last_error(domain: str, res: any):
     # 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
         ])