for item in items:
logger.debug("item[]='%s'", type(item))
domain = item.decode_contents()
+ domain = tidyup.domain(domain) if domain != None and domain != "" else None
logger.debug("domain='%s' - AFTER!", domain)
- if domain == "":
- logger.debug("domain is empty - SKIPPED!")
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain)
continue
logger.debug("domain='%s' - BEFORE!", domain)
logger.debug("rss[]='%s'", type(rss))
for item in rss.items:
logger.debug("item[%s]='%s'", type(item), item)
- domain = tidyup.domain(item.link.split("=")[1])
+ domain = item.link.split("=")[1]
+ domain = tidyup.domain(domain) if domain != None and domain != "" else None
logger.debug("domain='%s' - AFTER!", domain)
- if domain == "":
- logger.debug("domain is empty - SKIPPED!")
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain)
continue
logger.debug("domain='%s' - BEFORE!", domain)
logger.debug("element[]='%s'", type(element))
for href in element["href"].split(","):
logger.debug("href[%s]='%s' - BEFORE!", type(href), href)
- domain = tidyup.domain(href)
+ domain = tidyup.domain(href) if href != None and href != "" else None
logger.debug("domain='%s' - AFTER!", domain)
- if domain == "":
- logger.debug("domain is empty - SKIPPED!")
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain)
continue
logger.debug("domain='%s' - BEFORE!", domain)
cnt = cnt + 1
logger.debug("domain='%s',severity='%s',reject_media='%s',reject_reports='%s'", domain, severity, reject_media, reject_reports)
- if domain == "":
- logger.debug("domain is empty - SKIPPED!")
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty - SKIPPED!", domain)
continue
elif domain.endswith(".onion"):
logger.debug("domain='%s' is a TOR .onion domain - SKIPPED", domain)
logger.debug("domain='%s' - AFTER!", domain)
if domain is None or domain == "":
- logger.debug("domain='%s' is empty - SKIPPED!", domain)
+ logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain)
continue
elif not domain_helper.is_wanted(domain):
logger.debug("domain='%s' is not wanted - SKIPPED!", domain)
logger.info("Checking %d row(s) ...", len(rows))
for row in rows:
logger.debug("row[]='%s'", type(row))
- domain = tidyup.domain(row.contents[0])
+ domain = tidyup.domain(row.contents[0]) if row.contents[0] != None and row.contents[0] != "" else None
logger.debug("domain='%s' - AFTER!", domain)
- if domain == "":
- logger.debug("domain is empty - SKIPPED!")
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain)
continue
logger.debug("domain='%s' - BEFORE!", domain)
continue
logger.debug("row[hostname]='%s' - BEFORE!", row["hostname"])
- domain = tidyup.domain(row["hostname"])
+ domain = tidyup.domain(row["hostname"]) if row["hostname"] != None and row["hostname"] != "" else None
logger.debug("domain='%s' - AFTER!", domain)
- if domain == "":
- logger.debug("domain is empty after tidyup: row[hostname]='%s' - SKIPPED!", row["hostname"])
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain(): row[hostname]='%s' - SKIPPED!", domain, row["hostname"])
continue
logger.debug("domain='%s' - BEFORE!", domain)
logger.info("Checking %d row(s) ...", len(rows))
for row in rows:
logger.debug("row[]='%s'", type(row))
- domain = tidyup.domain(row["name"])
+ domain = tidyup.domain(row["name"]) if row["name"] != None and row["name"] != "" else None
logger.debug("domain='%s' - AFTER!", domain)
- if domain == "":
- logger.debug("domain is empty - SKIPPED!")
+ if domain is None and domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain)
continue
logger.debug("domain='%s' - BEFORE!", domain)
continue
logger.debug("domain='%s' - BEFORE!", domain)
- domain = tidyup.domain(domain)
+ domain = tidyup.domain(domain) if domain != None and domain != "" else None
logger.debug("domain='%s' - AFTER!", domain)
- if domain == "":
- logger.debug("Empty domain after tidyup.domain() from origin='%s' - SKIPPED!", row["domain"])
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", domain, row["domain"])
continue
elif domain not in peers:
logger.debug("Appending domain='%s' to peers list for relay='%s' ...", domain, row["domain"])
link = tag.find("a")
logger.debug("link[%s]='%s'", type(link), link)
if link is None:
- logger.warning("tag='%s' has no a-tag ...", tag)
+ logger.warning("tag='%s' has no a-tag - SKIPPED!", tag)
+ continue
+ elif "href" not in link:
+ logger.warning("link()=%d has no key 'href' - SKIPPED!", len(link))
continue
components = urlparse(link["href"])
domain = components.netloc.lower()
logger.debug("domain='%s' - BEFORE!", domain)
- domain = tidyup.domain(domain)
+ domain = tidyup.domain(domain) if domain != None and domain != "" else None
logger.debug("domain='%s' - AFTER!", domain)
- if domain == "":
- logger.debug("Empty domain after tidyup.domain() from origin='%s' - SKIPPED!", row["domain"])
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", domain, row["domain"])
continue
elif domain not in peers:
logger.debug("Appending domain='%s' to peers list for relay='%s' ...", domain, row["domain"])
if dict_helper.has_key(domains, "domain", domain):
logger.debug("domain='%s' already added", domain)
continue
- elif not domain_helper.is_wanted(domain):
- logger.debug("domain='%s' is not wanted - SKIPPED!", domain)
- continue
logger.debug("Appending domain='%s',origin='%s',software='%s'", domain, row["domain"], row["software"])
domains.append({
elif row["software"] == "pub-relay":
logger.debug("Checking %d peer(s) row[domain]='%s' ...", len(raw["json"]["metadata"]["peers"]), row["domain"])
for domain in raw["json"]["metadata"]["peers"]:
- logger.debug("domain='%s'", domain)
- if domain not in peers:
+ logger.debug("domain='%s' - BEFORE!", domain)
+ domain = tidyup.domain(domain) if domain != None and domain != "" else None
+ logger.debug("domain='%s' - AFTER!", domain)
+
+ if domain is None or domain == "":
+ logger.debug("domain='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", domain, row["domain"])
+ continue
+ elif domain not in peers:
logger.debug("Appending domain='%s' to peers list for relay='%s' ...", domain, row["domain"])
peers.append(domain)
if dict_helper.has_key(domains, "domain", domain):
logger.debug("domain='%s' already added", domain)
continue
- elif not domain_helper.is_wanted(domain):
- logger.debug("domain='%s' is not wanted - SKIPPED!", domain)
- continue
logger.debug("Appending domain='%s',origin='%s',software='%s'", domain, row["domain"], row["software"])
domains.append({
logger.info("Checking %d domains ...", len(domains))
for row in domains:
logger.debug("row[domain]='%s',row[origin]='%s'", row["domain"], row["origin"])
- if instances.is_registered(row["domain"]):
+ if not domain_helper.is_wanted(row["domain"]):
+ logger.debug("row[domain]='%s' is not wanted - SKIPPED!", row["domain"])
+ continue
+ elif instances.is_registered(row["domain"]):
logger.debug("row[domain]='%s' is already registered - SKIPPED!", row["domain"])
continue