def fetch_observer(args: argparse.Namespace) -> int:
logger.debug("args[]='%s' - CALLED!", type(args))
types = [
- "akoma",
+ "akkoma",
"birdsitelive",
"bookwyrm",
"calckey",
locking.acquire()
# Static URLs
- urls = (
- "https://seirdy.one/pb/bsl.txt",
- )
+ urls = ({
+ "blocker": "seirdy.one",
+ "url" : "https://seirdy.one/pb/bsl.txt",
+ },)
logger.info("Checking %d text file(s) ...", len(urls))
- for url in urls:
- logger.debug("Fetching url='%s' ...", url)
- response = utils.fetch_url(url, network.web_headers, (config.get("connection_timeout"), config.get("read_timeout")))
+ for row in urls:
+ logger.debug("Fetching row[url]='%s' ...", row['url'])
+ response = utils.fetch_url(row['url'], network.web_headers, (config.get("connection_timeout"), config.get("read_timeout")))
logger.debug("response.ok='%s',response.status_code=%d,response.text()=%d", response.ok, response.status_code, len(response.text))
if response.ok and response.status_code < 300 and response.text != "":
logger.debug("domain='%s' is not wanted - SKIPPED!", domain)
continue
- logger.debug("domain='%s'", domain)
- processed = utils.process_domain(domain, 'seirdy.one', inspect.currentframe().f_code.co_name)
+ logger.debug("domain='%s',row[blocker]='%s'", domain, row['blocker'])
+ processed = utils.process_domain(domain, row['blocker'], inspect.currentframe().f_code.co_name)
logger.debug("processed='%s'", processed)
if not processed:
logger.debug("Invoking instances.set_total_peerlist(%s,%d) ...", domain, len(peerlist))
instances.set_total_peers(domain, peerlist)
+ if instances.has_pending(domain):
+ logger.debug("domain='%s' has pending nodeinfo data, flushing ...", domain)
+ instances.update_data(domain)
+
if peerlist is None:
logger.warning("Cannot fetch peers: domain='%s'", domain)
return
- elif instances.has_pending(domain):
- logger.debug("domain='%s' has pending nodeinfo data, flushing ...", domain)
- instances.update_data(domain)
logger.info("Checking %d instance(s) from domain='%s',software='%s' ...", len(peerlist), domain, software)
for instance in peerlist:
logger.debug("blocked='%s',reason='%s'", blocked, reason)
if blocked == "":
- logger.debug("line[]='%s' returned empty blocked domain - SKIPPED!")
+ logger.debug("line[]='%s' returned empty blocked domain - SKIPPED!", type(line))
+ continue
+ elif not utils.is_domain_wanted(blocked):
+ logger.debug("blocked='%s' is not wanted - SKIPPED!", domain)
continue
blocked = utils.deobfuscate_domain(blocked, domain)
logger.warning("Exception '%s' during fetching instances (fetch_oliphant) from domain='%s'", type(exception), domain)
instances.set_last_error(domain, exception)
+ if instances.has_pending(domain):
+ logger.debug("domain='%s' has pending data updates")
+ instances.update_data(domain)
+
logger.debug("processed='%s' - EXIT!", processed)
return processed