logger.debug("Invoking cookies.clear(%s) ...", blocker)
cookies.clear(blocker)
- logger.debug("config[bot_enabled]='%s',blockdict()=%d'", config.get("bot_enabled"), len(blockdict))
+ logger.debug("config.get(bot_enabled)='%s',blockdict()=%d'", config.get("bot_enabled"), len(blockdict))
if config.get("bot_enabled") and len(blockdict) > 0:
logger.info("Sending bot POST for blocker='%s',blockdict()=%d ...", blocker, len(blockdict))
network.send_bot_post(blocker, blockdict)
logger.debug("Invoking commit() ...")
database.connection.commit()
+ logger.debug("config.get(bot_enabled)='%s',blockdict()=%d", config.get("bot_enabled"), len(blockdict))
if config.get("bot_enabled") and len(blockdict) > 0:
logger.info("Sending bot POST for blocker='todon.eu',blockdict()=%d ...", len(blockdict))
network.send_bot_post("todon.eu", blockdict)
logger.debug("Invoking commit() ...")
database.connection.commit()
+ logger.debug("config.get(bot_enabled)='%s',blockdict()=%d", config.get("bot_enabled"), len(blockdict))
if config.get("bot_enabled") and len(blockdict) > 0:
logger.info("Sending bot POST for blocker='chaos.social',blockdict()=%d ...", len(blockdict))
network.send_bot_post("chaos.social", blockdict)
logger.debug("Invoking commit() ...")
database.connection.commit()
+ logger.debug("config.get(bot_enabled)='%s',blockdict()=%d", config.get("bot_enabled"), len(blockdict))
if config.get("bot_enabled") and len(blockdict) > 0:
logger.info("Sending bot POST for blocker='%s',blockdict()=%d ...", block["blocker"], len(blockdict))
network.send_bot_post(block["blocker"], blockdict)
logger.debug("Invoking commit() ...")
database.connection.commit()
+ logger.debug("config.get(bot_enabled)='%s',blockdict()=%d", config.get("bot_enabled"), len(blockdict))
if config.get("bot_enabled") and len(blockdict) > 0:
logger.info("Sending bot POST for blocker='%s,blockdict()=%d ...", blocker, len(blockdict))
network.send_bot_post(blocker, blockdict)
logger.debug("Invoking commit() ...")
database.connection.commit()
+ logger.debug("config.get(bot_enabled)='%s',blockdict()=%d", config.get("bot_enabled"), len(blockdict))
if config.get("bot_enabled") and len(blockdict) > 0:
logger.info("Sending bot POST for blocker='%s,blockdict()=%d ...", row["domain"], len(blockdict))
network.send_bot_post(row["domain"], blockdict)
data=data,
headers={**api_headers, **headers},
timeout=(config.get("connection_timeout"), config.get("read_timeout")),
- cookies=cookies.get_all(domain) if cookies.has(domain) else dict()
+ cookies=cookies.get_all(domain) if cookies.has(domain) else dict(),
+ allow_redirects=False
)
logger.debug("Parsing JSON response from domain='%s',path='%s' ...", domain, path)
f"https://{domain}{path}",
headers={**api_headers, **headers},
timeout=timeout,
- cookies=cookies.get_all(domain) if cookies.has(domain) else {}
+ cookies=cookies.get_all(domain) if cookies.has(domain) else {},
+ allow_redirects=False
)
except exceptions as exception:
logger.debug("Returning json_reply(%d)[]='%s' - EXIT!", len(json_reply), type(json_reply))
return json_reply
-def send_bot_post(domain: str, blocklist: dict):
+def send_bot_post(domain: str, blocklist: list):
logger.debug("domain='%s',blocklist()=%d - CALLED!", domain, len(blocklist))
domain_helper.raise_on(domain)
- if not isinstance(blocklist, dict):
- raise ValueError(f"Parameter blocklist[]='{type(blocklist)}' is not 'dict'")
+ if not isinstance(blocklist, list):
+ raise ValueError(f"Parameter blocklist[]='{type(blocklist)}' is not 'list'")
+ elif len(blocklist) == 0:
+ raise ValueError("Parameter 'blocklist' is empty")
message = f"{domain} has blocked the following instances:\n\n"
truncated = False
"content_type": "text/plain"
},
headers=botheaders,
- timeout=10
+ timeout=(config.get("connection_timeout"), config.get("read_timeout")),
+ allow_redirects=False
).json()
return True
f"https://{domain}{path}",
headers=headers,
timeout=timeout,
- cookies=cookies.get_all(domain) if cookies.has(domain) else {}
+ cookies=cookies.get_all(domain) if cookies.has(domain) else {},
+ allow_redirects=False
)
except exceptions as exception: