domains.append(domain)
logger.debug("Processing domain='%s' ...", domain)
- processed = processing.domain(domain, block["blocker"], inspect.currentframe().f_code.co_name)
+ processed = processing.instance(domain, block["blocker"], inspect.currentframe().f_code.co_name)
logger.debug("processed='%s'", processed)
if processing.block(block["blocker"], domain, None, severity) and config.get("bot_enabled"):
continue
logger.debug("Processing domain='%s',row[blocker]='%s'", domain, row["blocker"])
- processed = processing.domain(domain, row["blocker"], inspect.currentframe().f_code.co_name)
+ processed = processing.instance(domain, row["blocker"], inspect.currentframe().f_code.co_name)
logger.debug("processed='%s'", processed)
if not processed:
continue
logger.debug("Proccessing blocked='%s' ...", block["blocked"])
- processing.domain(block["blocked"], "climatejustice.social", inspect.currentframe().f_code.co_name)
+ processing.instance(block["blocked"], "climatejustice.social", inspect.currentframe().f_code.co_name)
blockdict = list()
for blocker in domains:
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
-def domain(name: str, blocker: str, command: str) -> bool:
- logger.debug("name='%s',blocker='%s',command='%s' - CALLED!", name, blocker, command)
- domain_helper.raise_on(name)
+def instance(blocked: str, blocker: str, command: str) -> bool:
+ logger.debug("blocked='%s',blocker='%s',command='%s' - CALLED!", blocked, blocker, command)
+ domain_helper.raise_on(blocked)
domain_helper.raise_on(blocker)
if not isinstance(command, str):
elif command == "":
raise ValueError("Parameter 'command' is empty")
- logger.debug("name='%s' - BEFORE!", name)
- name = utils.deobfuscate(name, blocker)
+ logger.debug("blocked='%s' - BEFORE!", blocked)
+ blocked = utils.deobfuscate(blocked, blocker)
- logger.debug("name='%s' - DEOBFUSCATED!", name)
+ logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
if instances.has_pending(blocker):
logger.debug("Flushing updates for blocker='%s' ...", blocker)
instances.update(blocker)
- if not domain_helper.is_wanted(name):
- logger.debug("name='%s' is not wanted - SKIPPED!", name)
+ if not domain_helper.is_wanted(blocked):
+ logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
return False
- elif instances.is_recent(name):
- logger.debug("name='%s' has been recently checked - SKIPPED!", name)
+ elif instances.is_recent(blocked):
+ logger.debug("blocked='%s' has been recently checked - SKIPPED!", blocked)
return False
processed = False
try:
- logger.info("Fetching instances for name='%s',blocker='%s',command='%s' ...", name, blocker, command)
- federation.fetch_instances(name, blocker, None, command)
+ logger.info("Fetching instances for blocked='%s',blocker='%s',command='%s' ...", blocked, blocker, command)
+ federation.fetch_instances(blocked, blocker, None, command)
processed = True
except network.exceptions as exception:
- logger.warning("Exception '%s' during fetching instances (%s) from name='%s'", type(exception), command, name)
- instances.set_last_error(name, exception)
+ logger.warning("Exception '%s' during fetching instances (%s) from blocked='%s'", type(exception), command, blocked)
+ instances.set_last_error(blocked, exception)
- logger.debug("Checking if name='%s' has pending updates ...", name)
- if instances.has_pending(name):
- logger.debug("Flushing updates for name='%s' ...", name)
- instances.update(name)
+ logger.debug("Checking if blocked='%s' has pending updates ...", blocked)
+ if instances.has_pending(blocked):
+ logger.debug("Flushing updates for blocked='%s' ...", blocked)
+ instances.update(blocked)
logger.debug("processed='%s' - EXIT!", processed)
return processed
domain_helper.raise_on(blocker)
domain_helper.raise_on(blocked)
- added = False
if not isinstance(reason, str) and reason is not None:
raise ValueError(f"Parameter reason[]='{type(reason)}' is not of type 'str'")
elif not isinstance(block_level, str):
elif blacklist.is_blacklisted(blocked):
raise ValueError(f"blocked='{blocked}' is blacklisted but function was invoked")
+ added = False
if not blocks.is_instance_blocked(blocker, blocked, block_level):
logger.debug("Invoking blocks.add(%s, %s, %s, %s) ...", blocker, blocked, reason, block_level)
blocks.add(blocker, blocked, reason, block_level)
added = True
else:
- logger.debug("Updating block last seen and reason for blocker='%s',blocked='%s' ...", blocker, blocked)
+ logger.debug("Updating last_seen for blocker='%s',blocked='%s',block_level='%s' ...", blocker, blocked, block_level)
blocks.update_last_seen(blocker, blocked, block_level)
logger.debug("added='%s' - EXIT!", added)