]> git.mxchange.org Git - fba.git/blobdiff - fba/networks/lemmy.py
Continued:
[fba.git] / fba / networks / lemmy.py
index 638cf79d3b12e2787732b57fb33a46973a155973..9b0351773b1f6405c3ebf4d4115ebbb30c352564 100644 (file)
@@ -19,6 +19,7 @@ import logging
 
 import bs4
 
+from fba.helpers import blacklist
 from fba.helpers import config
 from fba.helpers import domain as domain_helper
 from fba.helpers import tidyup
@@ -71,6 +72,9 @@ def fetch_peers(domain: str, origin: str) -> list:
     logger.debug("domain='%s',origin='%s' - CALLED!", domain, origin)
     domain_helper.raise_on(domain)
 
+    if blacklist.is_blacklisted(domain):
+        raise Exception(f"domain='{domain}' is blacklisted but function is invoked.")
+
     peers = list()
 
     # No CSRF by default, you don't have to add network.api_headers by yourself here
@@ -121,7 +125,9 @@ def fetch_blocks(domain: str) -> list:
     logger.debug("domain='%s - CALLED!", domain)
     domain_helper.raise_on(domain)
 
-    if not instances.is_registered(domain):
+    if blacklist.is_blacklisted(domain):
+        raise Exception(f"domain='{domain}' is blacklisted but function is invoked.")
+    elif not instances.is_registered(domain):
         raise Exception(f"domain='{domain}' is not registered but function is invoked.")
 
     blocklist = list()
@@ -233,6 +239,9 @@ def fetch_instances(domain: str, origin: str) -> list:
     logger.debug("domain='%s',origin='%s' - CALLED!", domain, origin)
     domain_helper.raise_on(domain)
 
+    if blacklist.is_blacklisted(domain):
+        raise Exception(f"domain='{domain}' is blacklisted but function is invoked.")
+
     peers = list()
 
     try: