raise ValueError("Parameter 'domain' is empty")
# DEBUG: print("DEBUG: BEFORE error[]:", type(error))
- if isinstance(error, BaseException) or isinstance(error, json.decoder.JSONDecodeError):
+ if isinstance(error, (BaseException, json.decoder.JSONDecodeError)):
error = f"error[{type(error)}]='{str(error)}'"
# DEBUG: print("DEBUG: AFTER error[]:", type(error))
# DEBUG: print(f"DEBUG: Setting last_error_details='{error.reason}'")
set_data("last_status_code" , domain, error.status_code)
set_data("last_error_details", domain, error.reason)
+ elif not isinstance(error, dict):
+ raise KeyError(f"Cannot handle keys in error[{type(error)}]='{error}'")
elif "status_code" in error and "error_message" in error:
# DEBUG: print(f"DEBUG: Setting last_error_details='{error['error_message']}'")
set_data("last_status_code" , domain, error["status_code"])
elif "json" in error and "error" in error["json"]:
set_data("last_status_code" , domain, error["status_code"])
set_data("last_error_details", domain, error["json"]["error"])
- else:
- raise KeyError(f"Cannot handle keys in error[{type(error)}]='{error}'")
# Running pending updated
# DEBUG: print(f"DEBUG: Invoking update_data({domain}) ...")
# DEBUG: print(f"DEBUG: recently='{recently}' - EXIT!")
return recently
-def deobsure(char: str, domain: str, hash: str = None) -> tuple:
- #print(f"DEBUG: char='{char}',domain='{domain}',hash='{hash}' - CALLED!")
+def deobsure(char: str, domain: str, blocked_hash: str = None) -> tuple:
+ #print(f"DEBUG: char='{char}',domain='{domain}',blocked_hash='{blocked_hash}' - CALLED!")
if not isinstance(char, str):
raise ValueError(f"Parameter char[]='{type(char)}' is not 'str'")
elif char == "":
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
elif domain == "":
raise ValueError("Parameter 'domain' is empty")
- elif not isinstance(hash, str) and hash is not None:
- raise ValueError(f"Parameter hash[]='{type(hash)}' is not 'str'")
+ elif not isinstance(blocked_hash, str) and blocked_hash is not None:
+ raise ValueError(f"Parameter blocked_hash[]='{type(blocked_hash)}' is not 'str'")
- if isinstance(hash, str):
+ if isinstance(blocked_hash, str):
fba.cursor.execute(
- "SELECT domain, origin, nodeinfo_url FROM instances WHERE hash = ? LIMIT 1", [hash]
+ "SELECT domain, origin, nodeinfo_url FROM instances WHERE hash = ? LIMIT 1", [blocked_hash]
)
else:
fba.cursor.execute(