from fba import utils
from fba.helpers import config
+from fba.helpers import dicts as dict_helper
from fba.helpers import domain as domain_helper
from fba.helpers import tidyup
logger.debug("domain='%s' - CALLED!", domain)
domain_helper.raise_on(domain)
- logger.debug("Fetching misskey blocks from domain='%s'", domain)
- blocklist = list()
-
- offset = 0
- step = config.get("misskey_limit")
-
# No CSRF by default, you don't have to add network.api_headers by yourself here
headers = tuple()
instances.set_last_error(domain, exception)
return list()
+ blocklist = list()
+ offset = 0
+ step = config.get("misskey_limit")
+
# iterating through all "suspended" (follow-only in its terminology)
# instances page-by-page since it doesn't support sending them all at once
+ logger.debug("Fetching misskey blocks from domain='%s'", domain)
while True:
try:
logger.debug("Fetching offset=%d from domain='%s' ...", offset, domain)
count = 0
for instance in rows:
# Is it there?
- logger.debug("instance[%s]='%s'", type(instance), instance)
- if "isSuspended" in instance and instance["isSuspended"]:
+ logger.debug("instance[]='%s'", type(instance))
+ blocked = tidyup.domain(instance["host"])
+ if "isSuspended" in instance and instance["isSuspended"] and not dict_helper.has_key(blocklist, "blocked", blocked):
count = count + 1
+ logger.debug("Appending blocker='%s',blocked='%s',block_level='suspended'", domain, blocked)
blocklist.append({
"blocker" : domain,
- "blocked" : tidyup.domain(instance["host"]),
+ "blocked" : blocked,
"reason" : None,
"block_level": "suspended",
})
count = 0
for instance in rows:
# Is it there?
- logger.debug("instance[%s]='%s'", type(instance), instance)
- if "isBlocked" in instance and instance["isBlocked"]:
+ logger.debug("instance[]='%s'", type(instance))
+ blocked = tidyup.domain(instance["host"])
+ if "isBlocked" in instance and instance["isBlocked"] and not dict_helper.has_key(blocklist, "blocked", blocked):
count = count + 1
- blocked = tidyup.domain(instance["host"])
logger.debug("Appending blocker='%s',blocked='%s',block_level='reject'", domain, blocked)
blocklist.append({
"blocker" : domain,