logger.debug("args[]='%s' - CALLED!", type(args))
# Fetch rows
- database.cursor.execute("SELECT domain, nodeinfo_url FROM instances WHERE nodeinfo_url IS NOT NULL ORDER BY domain ASC")
+ database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE nodeinfo_url IS NOT NULL ORDER BY domain ASC")
cnt = 0
for row in database.cursor.fetchall():
- logger.debug("Checking row[domain]='%s',row[nodeinfo_url]='%s' ...", row["domain"], row["nodeinfo_url"])
+ logger.debug("Checking row[domain]='%s',row[software]='%s',row[nodeinfo_url]='%s' ...", row["domain"], row["software"], row["nodeinfo_url"])
punycode = row["domain"].encode("idna").decode("utf-8")
if row["nodeinfo_url"].startswith("/"):
logger.debug("row[nodeinfo_url]='%s' is a relative URL and always matches", row["nodeinfo_url"])
continue
elif row["nodeinfo_url"].find(punycode) == -1 and row["nodeinfo_url"].find(row["domain"]) == -1:
- logger.warning("punycode='%s' is not found in row[nodeinfo_url]='%s'", punycode, row["nodeinfo_url"])
+ logger.warning("punycode='%s' is not found in row[nodeinfo_url]='%s',row[software]='%s'", punycode, row["nodeinfo_url"], row["software"])
cnt = cnt + 1
logger.info("Found %d row(s)", cnt)
logger.debug("data[]='%s'", type(data))
if "error_message" not in data and "json" in data:
- logger.debug("Success: request='%s'", request)
+ logger.debug("Success: request='%s' - Setting detection_mode=STATIC_CHECK ...", request)
instances.set_detection_mode(domain, "STATIC_CHECK")
instances.set_nodeinfo_url(domain, request)
break
logger.debug("link[href]='%s',data[]='%s'", link["href"], type(data))
if "error_message" not in data and "json" in data:
- logger.debug("Found JSON data()=%d,link[href]='%s'", len(data), link["href"])
+ logger.debug("Found JSON data()=%d,link[href]='%s' - Setting detection_mode=AUTO_DISCOVERY ...", len(data), link["href"])
instances.set_detection_mode(domain, "AUTO_DISCOVERY")
instances.set_nodeinfo_url(domain, link["href"])
logger.debug("software[%s]='%s'", type(software), software)
if software is not None and software != "":
- logger.info("domain='%s' is generated by software='%s'", domain, software)
+ logger.info("domain='%s' is generated by software='%s' - Setting detection_mode=GENERATOR ...", domain, software)
instances.set_detection_mode(domain, "GENERATOR")
elif isinstance(site_name, bs4.element.Tag) and isinstance(site_name.get("content"), str):
logger.debug("Found property=og:site_name, domain='%s'", domain)
logger.debug("software[%s]='%s'", type(software), software)
if software is not None and software != "":
- logger.info("domain='%s' has og:site_name='%s'", domain, software)
+ logger.debug("domain='%s' has og:site_name='%s' - Setting detection_mode=SITE_NAME ...", domain, software)
instances.set_detection_mode(domain, "SITE_NAME")
logger.debug("software[]='%s'", type(software))
logger.debug("Generator for domain='%s' is: '%s'", domain, software)
if "status" in data and data["status"] == "error" and "message" in data:
- logger.warning("JSON response is an error: '%s'", data["message"])
+ logger.warning("JSON response is an error: '%s' - Resetting detection_mode,nodeinfo_url ...", data["message"])
instances.set_last_error(domain, data["message"])
instances.set_detection_mode(domain, None)
instances.set_nodeinfo_url(domain, None)
software = data["software"]["name"]
logger.debug("software[%s]='%s' - FOUND!", type(software), software)
elif "message" in data:
- logger.warning("JSON response contains only a message: '%s'", data["message"])
+ logger.warning("JSON response contains only a message: '%s' - Resetting detection_mode,nodeinfo_url ...", data["message"])
instances.set_last_error(domain, data["message"])
instances.set_detection_mode(domain, None)
instances.set_nodeinfo_url(domain, None)
+
+ logger.debug("Invoking fetch_generator_from_path(%s) ...", domain)
software = fetch_generator_from_path(domain)
logger.debug("Generator for domain='%s' is: '%s'", domain, software)
elif "software" not in data or "name" not in data["software"]:
- logger.debug("JSON response from domain='%s' does not include [software][name], fetching / ...", domain)
+ logger.debug("JSON response from domain='%s' does not include [software][name] - Resetting detection_mode,nodeinfo_url ...", domain)
instances.set_detection_mode(domain, None)
instances.set_nodeinfo_url(domain, None)
+
+ logger.debug("Invoking fetch_generator_from_path(%s) ...", domain)
software = fetch_generator_from_path(domain)
logger.debug("Generator for domain='%s' is: '%s'", domain, software)