raise Exception(f"domain='{domain}' is blacklisted, but method invoked")
elif domain.find("/profile/") > 0 or domain.find("/users/") > 0 or (is_registered(domain.split("/")[0]) and domain.find("/c/") > 0):
raise Exception(f"domain='{domain}' is a single user")
+ elif domain.find("/tag/") > 0:
+ raise Exception(f"domain='{domain}' is a tag")
if software is None:
try:
logger.debug("registered='%s' - EXIT!", registered)
return registered
-def is_recent(domain: str) -> bool:
- logger.debug("domain='%s' - CALLED!", domain)
+def is_recent(domain: str, column: str = "last_instance_fetch") -> bool:
+ logger.debug("domain='%s',column='%s' - CALLED!", domain)
domain_helper.raise_on(domain)
- if not is_registered(domain):
+
+ if not isinstance(column, str):
+ raise ValueError(f"Parameter column[]='{type(column)}' is not 'str'")
+ elif column not in ["last_instance_fetch", "last_blocked"]:
+ raise ValueError(f"Parameter column='{column}' is not expected")
+ elif not is_registered(domain):
logger.debug("domain='%s' is not registered, returning False - EXIT!", domain)
return False
# Query database
- database.cursor.execute("SELECT last_instance_fetch FROM instances WHERE domain = ? LIMIT 1", [domain])
+ database.cursor.execute(f"SELECT {column} FROM instances WHERE domain = ? LIMIT 1", [domain])
# Fetch row
fetched = database.cursor.fetchone()[0]