- `pleroma.envs.net` does now publish a more detailed blocklist than its CSV file
- but still it can be used as peer source (key `only_peers` set to `True`)
- exception messages improved
logger.debug("block[blocker]='%s' does not match args.domain='%s' - SKIPPED!", block["blocker"], args.domain)
continue
- logger.debug("Invoking processing.csv_block(%s, %s, fetch_csv) ...", block["blocker"], block["csv_url"])
- processing.csv_block(block["blocker"], block["csv_url"], inspect.currentframe().f_code.co_name)
+ if block["only_peers"]:
+ logger.debug("block[blocker]='%s' is not registered, adding instance ...", block["blocker"])
+ processing.csv_instance(block["blocker"], block["csv_url"], inspect.currentframe().f_code.co_name)
+ else:
+ logger.debug("Invoking processing.csv_block(%s, %s, fetch_csv) ...", block["blocker"], block["csv_url"])
+ processing.csv_block(block["blocker"], block["csv_url"], inspect.currentframe().f_code.co_name)
logger.debug("Success - EXIT!")
return 0
# Blocklists hosted by oliphant
oliphant_blocklists = (
{
- "blocker": "mastodon.online",
- "csv_url": "mastodon/mastodon.online.csv",
+ "blocker" : "mastodon.online",
+ "csv_url" : "mastodon/mastodon.online.csv",
+ "only_peers": False,
},{
- "blocker": "mastodon.social",
- "csv_url": "mastodon/mastodon.social.csv",
+ "blocker" : "mastodon.social",
+ "csv_url" : "mastodon/mastodon.social.csv",
+ "only_peers": False,
},{
- "blocker": "mastodon.social",
- "csv_url": "other/missing-tier0-mastodon.social.csv",
+ "blocker" : "mastodon.social",
+ "csv_url" : "other/missing-tier0-mastodon.social.csv",
+ "only_peers": False,
},{
- "blocker": "seirdy.one",
- "csv_url": "mastodon/seirdy-tier0.csv",
+ "blocker" : "seirdy.one",
+ "csv_url" : "mastodon/seirdy-tier0.csv",
+ "only_peers": False,
},
)
# Other CSV files
csv_files = (
{
- "blocker": "pleroma.envs.net",
- "csv_url": "https://seirdy.one/pb/pleroma.envs.net.csv",
+ "blocker" : "pleroma.envs.net",
+ "csv_url" : "https://seirdy.one/pb/pleroma.envs.net.csv",
+ "only_peers": True,
},{
- "blocker": "social.mooneyed.de",
- "csv_url": "https://git.bka.li/kromonos/fedi-health/-/raw/master/_unified_tier3_blocklist.csv",
+ "blocker" : "social.mooneyed.de",
+ "csv_url" : "https://git.bka.li/kromonos/fedi-health/-/raw/master/_unified_tier3_blocklist.csv",
+ "only_peers": False,
},
)
# Default is not found
found = False
for row in oliphant_blocklists + csv_files:
- logger.debug("row[blocker]='%s',domain='%s'", row["blocker"], domain)
- if row["blocker"] == domain:
+ logger.debug("row[blocker]='%s',row[only_peers]='%s',domain='%s'", row["blocker"], row["only_peers"], domain)
+ if row["blocker"] == domain and not row["only_peers"]:
found = True
logger.debug("domain='%s' is found and excluded from regular fetch_blocks command - BREAK!", domain)
break
if not isinstance(key, str):
raise TypeError(f"Parameter key[]='{type(key)}' has not expected type 'str'")
elif key == "":
- raise ValueError("Parameter 'key' is empty")
+ raise ValueError("Parameter 'key' is an empty string")
elif not key in _config:
raise KeyError(f"key='{key}' does not exist in _config array")
elif not isinstance(key, str):
raise TypeError(f"Parameter key[]='{type(key)}' has not expected type 'str'")
elif key == "":
- raise ValueError("Parameter 'key' is empty")
+ raise ValueError("Parameter 'key' is an empty string")
has = False
logger.debug("Checking lists()=%d ...", len(lists))
if not isinstance(domain, str):
raise TypeError(f"Parameter domain[]='{type(domain)}' has not expected type 'str'")
elif domain == "":
- raise ValueError("Parameter 'domain' is empty")
+ raise ValueError("Parameter 'domain' is an empty string")
elif domain.lower() != domain:
raise ValueError(f"Parameter domain='{domain}' must be all lower-case")
elif "?" in domain:
elif not isinstance(url, str):
raise TypeError(f"Parameter url[]='{type(url)}' has not expected type 'str'")
elif url == "":
- raise ValueError("Parameter 'url' is empty")
+ raise ValueError("Parameter 'url' is an empty string")
elif not validators.url(url):
raise RuntimeError(f"Parameter url='{url}' is not a valid URL but function was invoked")
if not isinstance(domain, str):
raise TypeError(f"Parameter domain[]='{type(domain)}' has not expected type 'str'")
elif domain == "":
- raise ValueError("Parameter 'domain' is empty")
+ raise ValueError("Parameter 'domain' is an empty string")
wanted = True
if not isinstance(domain, str):
raise TypeError(f"Parameter domain[]='{type(domain)}' has not expected type 'str'")
elif domain == "":
- raise ValueError("Parameter 'domain' is empty")
+ raise ValueError("Parameter 'domain' is an empty string")
wanted = True
if domain.lower() != domain:
if not isinstance(command, str):
raise TypeError(f"Parameter command[]='{type(command)}' has not expected type 'str'")
elif command == "":
- raise ValueError("Parameter 'command' is empty")
+ raise ValueError("Parameter 'command' is an empty string")
elif blacklist.is_blacklisted(blocked):
raise RuntimeError(f"blocked='{blocked}' is blacklisted but function was invoked")
elif blacklist.is_blacklisted(blocker):
if not isinstance(url, str):
raise TypeError(f"url[]='{url}' has not expected type 'str'")
elif url in [None, ""]:
- raise ValueError("Parameter 'url' is empty")
+ raise ValueError("Parameter 'url' is an empty string")
elif not validators.url(url):
raise ValueError(f"Parameter url='{url}' is not a valid URL")
elif not isinstance(command, str):
raise TypeError(f"command[]='{command}' has not expected type 'str'")
elif command == "":
- raise ValueError("Parameter 'command' is empty")
+ raise ValueError("Parameter 'command' is an empty string")
elif blacklist.is_blacklisted(blocker):
raise RuntimeError(f"blocker='{blocker}' is blacklisted but function was invoked")
network.send_bot_post(blocker, blockdict)
logger.debug("EXIT!")
+
+def csv_instance(instance: str, url: str, command: str) -> None:
+ logger.debug("instance='%s',url='%s',command='%s' - CALLED!", instance, url, command)
+ domain_helper.raise_on(instance)
+
+ if not isinstance(url, str):
+ raise TypeError(f"url[]='{url}' has not expected type 'str'")
+ elif url in [None, ""]:
+ raise ValueError("Parameter 'url' is an empty string")
+ elif not validators.url(url):
+ raise ValueError(f"Parameter url='{url}' is not a valid URL")
+ elif not isinstance(command, str):
+ raise TypeError(f"command[]='{command}' has not expected type 'str'")
+ elif command == "":
+ raise ValueError("Parameter 'command' is an empty string")
+ elif blacklist.is_blacklisted(instance):
+ raise RuntimeError(f"instance='{instance}' is blacklisted but function was invoked")
+
+ # Init local variables
+ domains = []
+
+ logger.debug("Setting last_instance_fetch for instance='%s' ...", instance)
+ instances.set_last_instance_fetch(instance)
+
+ # Fetch this URL
+ logger.info("Fetching url='%s' for instance='%s' ...", url, instance)
+ rows = network.fetch_csv_rows(url)
+
+ logger.info("Checking %d CSV lines ...", len(rows))
+ for row in rows:
+ logger.debug("row[%s]='%s'", type(row), row)
+ domain = None
+
+ if "#domain" in row and row["#domain"] not in [None, ""]:
+ domain = tidyup.domain(row["#domain"])
+ elif "domain" in row and row["domain"] not in [None, ""]:
+ domain = tidyup.domain(row["domain"])
+ elif "Domain" in row and row["Domain"] not in [None, ""]:
+ domain = tidyup.domain(row["Domain"])
+ else:
+ logger.warning("row='%s' does not contain domain column - SKIPPED!", row)
+ continue
+
+ logger.debug("domain='%s'", domain)
+ if domain in [None, ""]:
+ logger.debug("domain='%s' is empty - SKIPPED!", domain)
+ continue
+ elif not domain_helper.is_tld_wanted(domain):
+ logger.debug("domain='%s' has an unwanted TLD - SKIPPED!", domain)
+ continue
+ elif domain.find("*") >= 0 or domain.find("?") >= 0:
+ logger.debug("domain='%s' is obfuscated - Invoking utils.deobfuscate(%s, %s) ...", domain, domain, instance)
+ domain = utils.deobfuscate(domain, instance)
+ logger.debug("domain='%s' - AFTER!", domain)
+
+ logger.debug("Marking domain='%s' as handled ...", domain)
+ domains.append(domain)
+
+ if not validators.domain(domain, rfc_2782=True):
+ logger.warning("domain='%s' is not a valid domain - SKIPPED!", domain)
+ continue
+ elif blacklist.is_blacklisted(domain):
+ logger.debug("domain='%s' is blacklisted - SKIPPED!", domain)
+ continue
+ elif instances.is_registered(domain):
+ logger.debug("domain='%s' is already registered - SKIPPED!", domain)
+ continue
+
+ logger.debug("Processing domain='%s',instance='%s',command='%s' ...", domain, instance, command)
+ processed = instance(domain, instance, command)
+ logger.debug("processed='%s'", processed)
+
+ logger.debug("Invoking commit() ...")
+ database.connection.commit()
+
+ logger.debug("Invoking instances.set_total_instances(%s, domains()=%d) ...", instance, len(domains))
+ instances.set_total_instances(instance, domains)
+
+ logger.debug("Checking if instance='%s' has pending updates ...", instance)
+ if instances.has_pending(instance):
+ logger.debug("Flushing updates for instance='%s' ...", instance)
+ instances.update(instance)
+
+ logger.debug("EXIT!")
if not isinstance(software, str) and software is not None:
raise TypeError(f"software[]='{type(software)}' is not type 'str'")
elif software == "":
- raise ValueError("Parameter 'software' is empty")
+ raise ValueError("Parameter 'software' is an empty string")
elif software.startswith("re:"):
logger.debug("Cutting prefix 're:' from software='%s' ...", software)
software = software.split(":")[1]
if not isinstance(software, str):
raise TypeError(f"Parameter software[]='{type(software)}' has not expected type 'str'")
elif software == "":
- raise ValueError("Parameter 'software' is empty")
+ raise ValueError("Parameter 'software' is an empty string")
elif "hosted on" not in software:
logger.warning("Cannot find 'hosted on' in software='%s'!", software)
return software
if not isinstance(software, str):
raise TypeError(f"Parameter software[]='{type(software)}' has not expected type 'str'")
elif software == "":
- raise ValueError("Parameter 'software' is empty")
+ raise ValueError("Parameter 'software' is an empty string")
elif "powered by" not in software:
logger.warning("Cannot find 'powered by' in software='%s'!", software)
return software
if not isinstance(software, str):
raise TypeError(f"Parameter software[]='{type(software)}' has not expected type 'str'")
elif software == "":
- raise ValueError("Parameter 'software' is empty")
+ raise ValueError("Parameter 'software' is an empty string")
elif not isinstance(until, str):
raise TypeError(f"Parameter until[]='{type(until)}' has not expected type 'str'")
elif until == "":
- raise ValueError("Parameter 'until' is empty")
+ raise ValueError("Parameter 'until' is an empty string")
elif not until in software:
logger.warning("Cannot find until='%s' in software='%s'!", until, software)
return software
if not isinstance(software, str):
raise TypeError(f"software[]='{type(software)}' is not type 'str'")
elif software == "":
- raise ValueError("Parameter 'software' is empty")
+ raise ValueError("Parameter 'software' is an empty string")
found = software in _relays
if not isinstance(string, str):
raise TypeError(f"Parameter string[]='{type(string)}' has not expected type 'str'")
elif string == "":
- raise ValueError("Parameter 'string' is empty")
+ raise ValueError("Parameter 'string' is an empty string")
# All lower-case and strip spaces out + last dot
string = string.lower().strip().rstrip(".").replace("..", ".")
elif not isinstance(command, str):
raise TypeError(f"Parameter command[]='{type(command)}' has not expected type 'str'")
elif command == "":
- raise ValueError("Parameter 'command' is empty")
+ raise ValueError("Parameter 'command' is an empty string")
elif command in ["fetch_blocks", "fetch_cs", "fetch_bkali", "fetch_relays", "fetch_fedipact", "fetch_joinmobilizon", "fetch_joinmisskey", "fetch_joinfediverse", "fetch_relaylist"] and origin is None:
raise ValueError(f"Parameter command='{command}' but origin is None, please fix invoking this function.")
elif not isinstance(path, str) and path is not None:
elif not isinstance(software, str) and software is not None:
raise TypeError(f"Parameter software[]='{type(software)}' has not expected type 'str'")
elif isinstance(software, str) and software == "":
- raise ValueError("Parameter 'software' is empty")
+ raise ValueError("Parameter 'software' is an empty string")
elif software is not None and software_helper.is_relay(software):
raise RuntimeError(f"domain='{domain}' is of software='{software}' and isn't supported here.")
elif not isinstance(origin, str) and origin is not None:
raise TypeError(f"Parameter origin[]='{type(origin)}' has not expected type 'str'")
elif isinstance(origin, str) and origin == "":
- raise ValueError("Parameter 'origin' is empty")
+ raise ValueError("Parameter 'origin' is an empty string")
if software == "misskey":
logger.debug("Invoking misskey.fetch_peers(%s) ...", domain)
elif not isinstance(path, str):
raise TypeError(f"path[]='{type(path)}' has not expected type 'str'")
elif path == "":
- raise ValueError("Parameter 'path' is empty")
+ raise ValueError("Parameter 'path' is an empty string")
elif not path.startswith("/"):
raise ValueError(f"path='{path}' does not start with / but should")
if not isinstance(rows, dict):
raise TypeError(f"Parameter rows[]='{type(rows)}' has not expected type 'dict'")
elif len(rows) == 0:
- raise ValueError("Parameter 'rows' is empty")
+ raise ValueError("Parameter 'rows' is an empty string")
# Init variables
peers = []
if not isinstance(url, str):
raise TypeError(f"Parameter url[]='{type(url)}' has not expected type 'str'")
elif url == "":
- raise ValueError("Parameter 'url' is empty")
+ raise ValueError("Parameter 'url' is an empty string")
elif not validators.url(url):
raise ValueError(f"Parameter url='{url}' is not a valid URL")
elif not isinstance(timeout, tuple):
elif not isinstance(blocklist, list):
raise TypeError(f"Parameter blocklist[]='{type(blocklist)}' has not expected type 'list'")
elif len(blocklist) == 0:
- raise ValueError("Parameter 'blocklist' is empty")
+ raise ValueError("Parameter 'blocklist' is an empty string")
elif config.get("bot_token") == "":
raise ValueError("config[bot_token] is not set")
elif not isinstance(path, str):
raise TypeError(f"Parameter path[]='{type(path)}' has not expected type 'str'")
elif path == "":
- raise ValueError("Parameter 'path' is empty")
+ raise ValueError("Parameter 'path' is an empty string")
elif not path.startswith("/"):
raise ValueError(f"path='{path}' does not start with / but should")
elif not isinstance(headers, dict):
if not isinstance(url, str):
raise TypeError(f"Parameter url[]='{type(url)}' has not expected type 'str'")
elif url == "":
- raise ValueError("Parameter 'url' is empty")
+ raise ValueError("Parameter 'url' is an empty string")
elif not validators.url(url):
raise ValueError(f"Parameter url='{url}' is not a valid URL")
elif not isinstance(headers, dict):
elif not isinstance(path, str):
raise TypeError(f"Parameter path[]='{type(path)}' has not expected type 'str'")
elif path == "":
- raise ValueError("Parameter 'path' is empty")
+ raise ValueError("Parameter 'path' is an empty string")
elif not path.startswith("/"):
raise ValueError(f"path='{path}' does not start with / but should")
elif not isinstance(allow_redirects, bool):
if not isinstance(block_level, str):
raise TypeError(f"Parameter block_level[]='{type(block_level)}' has not expected type 'str'")
elif block_level == "":
- raise ValueError("Parameter 'block_level' is empty")
+ raise ValueError("Parameter 'block_level' is an empty string")
elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"block_level='{block_level}' is not wanted.")
elif blacklist.is_blacklisted(blocker):
elif not isinstance(block_level, str):
raise TypeError(f"Parameter block_level[]='{type(block_level)}' has not expected type 'str'")
elif block_level == "":
- raise ValueError("Parameter 'block_level' is empty")
+ raise ValueError("Parameter 'block_level' is an empty string")
elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"block_level='{block_level}' is not wanted.")
elif blacklist.is_blacklisted(blocker):
if not isinstance(block_level, str):
raise TypeError(f"Parameter block_level[]='{type(block_level)}' has not expected type 'str'")
elif block_level == "":
- raise ValueError("Parameter 'block_level' is empty")
+ raise ValueError("Parameter 'block_level' is an empty string")
elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
elif blacklist.is_blacklisted(blocker):
if not isinstance(block_level, str) and block_level is not None:
raise TypeError(f"Parameter block_level[]='{type(block_level)}' has not expected type 'str'")
elif block_level == "":
- raise ValueError("Parameter 'block_level' is empty")
+ raise ValueError("Parameter 'block_level' is an empty string")
elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
elif blacklist.is_blacklisted(blocker):
if not isinstance(block_level, str):
raise TypeError(f"Parameter block_level[]='{type(block_level)}' has not expected type 'str'")
elif block_level == "":
- raise ValueError("Parameter 'block_level' is empty")
+ raise ValueError("Parameter 'block_level' is an empty string")
elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
elif blacklist.is_blacklisted(blocker):
if not isinstance(value, str):
raise TypeError(f"Parameter value[]='{type(value)}' has not expected type 'str'")
elif value == "":
- raise ValueError("Parameter 'value' is empty")
+ raise ValueError("Parameter 'value' is an empty string")
elif not isinstance(column, str):
raise TypeError(f"Parameter column[]='{type(column)}' has not expected type 'str'")
elif column == "":
- raise ValueError("Parameter 'column' is empty")
+ raise ValueError("Parameter 'column' is an empty string")
# Query database
database.cursor.execute(
if not isinstance(char, str):
raise TypeError(f"Parameter char[]='{type(char)}' has not expected type 'str'")
elif char == "":
- raise ValueError("Parameter 'char' is empty")
+ raise ValueError("Parameter 'char' is an empty string")
elif not isinstance(domain, str):
raise TypeError(f"Parameter domain[]='{type(domain)}'")
elif domain == "":
- raise ValueError("Parameter 'domain' is empty")
+ raise ValueError("Parameter 'domain' is an empty string")
elif not char in domain:
raise ValueError(f"char='{char}' not found in domain='{domain}' but function invoked")
elif not isinstance(blocked_hash, str) and blocked_hash is not None:
if not isinstance(url, str) and url is not None:
raise TypeError(f"Parameter url[]='{type(url)}' has not expected type 'str'")
elif url == "":
- raise ValueError("Parameter 'url' is empty")
+ raise ValueError("Parameter 'url' is an empty string")
elif url is not None and not validators.url(url):
raise ValueError(f"Parameter url='{url}' is not a valid URL")
if not isinstance(mode, str) and mode is not None:
raise TypeError(f"Parameter mode[]='{type(mode)}' has not expected type 'str'")
elif mode == "":
- raise ValueError("Parameter 'mode' is empty")
+ raise ValueError("Parameter 'mode' is an empty string")
# Set timestamp
_set_pending_data("detection_mode", domain, mode)
if not isinstance(software, str) and software is not None:
raise TypeError(f"Parameter software[]='{type(software)}' has not expected type 'str'")
elif software == "":
- raise ValueError("Parameter 'software' is empty")
+ raise ValueError("Parameter 'software' is an empty string")
# Set original software
_set_pending_data("original_software", domain, software)
if not isinstance(software, str) and software is not None:
raise TypeError(f"Parameter software[]='{type(software)}' has not expected type 'str'")
elif software == "":
- raise ValueError("Parameter 'software' is empty")
+ raise ValueError("Parameter 'software' is an empty string")
# Set software (maybe aliased to generic name)
_set_pending_data("software", domain, software)
if not isinstance(value, str):
raise TypeError(f"Parameter value[]='{type(value)}' has not expected type 'str'")
elif value == "":
- raise ValueError("Parameter 'value' is empty")
+ raise ValueError("Parameter 'value' is an empty string")
elif not isinstance(column, str):
raise TypeError(f"Parameter column[]='{type(column)}' has not expected type 'str'")
elif column == "":
- raise ValueError("Parameter 'column' is empty")
+ raise ValueError("Parameter 'column' is an empty string")
# Query database
database.cursor.execute(
if not isinstance(column, str):
raise TypeError(f"Parameter column[]='{type(column)}' has not expected type 'str'")
elif column == "":
- raise ValueError("Parameter 'column' is empty")
+ raise ValueError("Parameter 'column' is an empty string")
elif column in ["domain", "origin"]:
domain_helper.raise_on(search)
elif not isinstance(column, str):
raise TypeError(f"column='{type(column)}' has not expected type 'str'")
elif column == "":
- raise ValueError("Parameter 'column' is empty")
+ raise ValueError("Parameter 'column' is an empty string")
elif column not in ["domain", "origin"]:
raise ValueError(f"column='{column}' is not supported")
elif not isinstance(only, str) and only is not None:
raise TypeError(f"Parameter only[]='{type(only)}' has not expected type 'str'")
elif isinstance(only, str) and only == "":
- raise ValueError("Parameter 'only' is empty")
+ raise ValueError("Parameter 'only' is an empty string")
scripts = doc.find_all("script")
peers = []
elif not isinstance(row["host"], str):
logger.warning("row[host][]='%s' has not expected type 'str' - SKIPPED!", type(row["host"]))
continue
- elif row["host"] in [None, ""]:
- logger.warning("row[host]='%s' is empty,domain='%s' - SKIPPED!", row["host"], domain)
+ elif row["host"] == "":
+ logger.warning("row[host] is an empty string,domain='%s' - SKIPPED!", domain)
continue
elif row["host"] in peers:
logger.debug("Not adding row[host]='%s', already found - SKIPPED!", row["host"])
if "host" not in instance:
logger.warning("instance(%d)='%s' has no key 'host' - SKIPPED!", len(instance), instance)
continue
- elif instance["host"] in [None, ""]:
- logger.debug("instance[host]='%s' is None or empty - SKIPPED!", instance["host"])
+ elif not isinstance(instance["host"], str):
+ logger.warning("instance[host][]='%s' has not expected type 'str' - SKIPPED!", type(instance["host"]))
+ continue
+ elif instance["host"] == "":
+ logger.warning("instance[host] is an empty string,domain='%s' - SKIPPED!", domain)
continue
logger.debug("instance[host]='%s' - BEFORE!", instance["host"])
logger.debug("Appending mode2='%s',host='%s' ...", mode2, record[mode2]["host"])
peers.append(record[mode2]["host"])
+ logger.debug("rows()=%d,peers()=%d,start=%d", len(rows), len(peers), start)
if len(rows) < 100:
logger.debug("Reached end of JSON response, domain='%s'", domain)
break
logger.debug("block_level='%s' - AFTER!", block_level)
if block_level in [None, ""]:
- logger.warning("block_level is now empty!")
+ logger.warning("block_level='%s' is empty - SKIPPED!", block_level)
continue
elif block_level == "accept":
logger.debug("domain='%s' skipping block_level='accept'", domain)
else:
logger.warning("Cannot find 'mrf_simple_info' or 'quarantined_instances_info' in JSON reply: domain='%s'", domain)
- logger.debug("found='%s'", found)
+ logger.debug("found='%s',blockdict()=%d", found, len(blockdict))
if not found:
logger.debug("Did not find any useable JSON elements, domain='%s', continuing with /about page ...", domain)
blocklist = fetch_blocks_from_about(domain)
tds = line.find_all("td")
logger.debug("tds[%s]()=%d", type(tds), len(tds))
- if len(tds) == 0:
+ if len(tds) < 2:
logger.warning("No 'td' tag found in line[]='%s' - SKIPPED!", type(line))
continue
elif not isinstance(search, str):
raise TypeError(f"Parameter search[]='{type(search)}' has not expected type 'str'")
elif search == "":
- raise ValueError("Parameter 'search' is empty")
+ raise ValueError("Parameter 'search' is an empty string")
domains = []
logger.debug("Parsing %d tags ...", len(tags))
elif not isinstance(source, str):
raise TypeError(f"Parameter source[]='{type(source)}' is not type 'list'")
elif source == "":
- raise ValueError("Parameter 'source' is empty")
+ raise ValueError("Parameter 'source' is an empty string")
elif not isinstance(splitter, str):
raise TypeError(f"Parameter splitter[]='{type(splitter)}' is not type 'list'")
elif splitter == "":
- raise ValueError("Parameter 'splitter' is empty")
+ raise ValueError("Parameter 'splitter' is an empty string")
for domain in source.split(splitter):
logger.debug("domain='%s' - LOOP!", domain)
elif not isinstance(domain_hash, str) and domain_hash is not None:
raise TypeError(f"Parameter domain_hash[]='{type(domain_hash)}' has not expected type 'str'")
elif domain_hash == "":
- raise ValueError("Parameter 'domain_hash' is empty")
+ raise ValueError("Parameter 'domain_hash' is an empty string")
logger.debug("Checking domain='%s' ...", domain)
if domain.find("*") >= 0: