- check if domain is valid before checking if it is blacklisted, else an
exception will raise
import logging
import bs4
+import validators
from fba import database
from fba import utils
if blocked in [None, ""]:
logger.warning("blocked='%s' is empty after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", blocked, domain, block_level)
continue
+ elif validators.domain(blocked) and blacklist.is_blacklisted(blocked):
+ logger.debug("blocked='%s' is blacklisted - SKIPPED!")
+ continue
logger.debug("Invoking utils.deobfuscate(%s, %s) ...", blocked, domain)
blocked = utils.deobfuscate(blocked, domain)
logger.debug("domain='%s',blocker='%s',domain_hash='%s' - CALLED!", domain, blocker, domain_hash)
domain_helper.raise_on(blocker)
- if blacklist.is_blacklisted(domain):
+ if validators.domain(domain) and blacklist.is_blacklisted(domain):
raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(domain_hash, str) and domain_hash is not None:
raise ValueError(f"Parameter domain_hash[]='{type(domain_hash)}' is not of type 'str'")