import logging
+from fba.helpers import blacklist
from fba.helpers import domain as domain_helper
logging.basicConfig(level=logging.INFO)
logger.debug("domain='%s' - CALLED!")
domain_helper.raise_on(domain)
+ if blacklist.is_blacklisted(domain):
+ raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+
# Default is not found
found = False
for row in oliphant_blocklists + csv_files:
import logging
+from fba.helpers import blacklist
from fba.helpers import domain as domain_helper
logging.basicConfig(level=logging.INFO)
def store(domain: str, cookies: dict):
logger.debug("domain='%s',cookies()=%d - CALLED!", domain, len(cookies))
domain_helper.raise_on(domain)
- if not isinstance(cookies, dict):
+
+ if blacklist.is_blacklisted(domain):
+ raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ elif not isinstance(cookies, dict):
raise ValueError(f"Parameter cookies[]='{type(cookies)}' is not of type 'dict'")
_cookies[domain] = cookies
logger.debug("domain='%s' - CALLED!", domain)
domain_helper.raise_on(domain)
+ if blacklist.is_blacklisted(domain):
+ raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+
if domain not in _cookies:
return dict()
logger.debug("domain='%s' - CALLED!", domain)
domain_helper.raise_on(domain)
+ if blacklist.is_blacklisted(domain):
+ raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+
has_cookies = domain in _cookies
logger.debug("has_cookies='%s' - EXIT!", has_cookies)
logger.debug("domain='%s' - CALLED!", domain)
domain_helper.raise_on(domain)
+ if blacklist.is_blacklisted(domain):
+ raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+
if has(domain):
logger.debug("Removing cookies for domain='%s' ...", domain)
del _cookies[domain]
raise ValueError("Parameter 'block_level' is empty")
elif block_level in ["accept", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"block_level='{block_level}' is not wanted.")
+ elif blacklist.is_blacklisted(blocker):
+ raise Exception(f"blocker='{blocker}' is blacklisted but function invoked")
+ elif blacklist.is_blacklisted(blocked):
+ raise Exception(f"blocked='{blocked}' is blacklisted but function invoked")
elif not is_instance_blocked(blocker, blocked, block_level):
raise Exception(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function is invoked")