domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
# Default is not found
found = False
if not isinstance(block_level, str):
raise TypeError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'")
elif block_level in ["accept", "accepted"]:
- raise ValueError(f"Parameter block_level='{block_level}' is 'accept(ed)' but function was invoked")
+ raise RuntimeError(f"Parameter block_level='{block_level}' is 'accept(ed)' but function was invoked")
elif block_level == "silence":
logger.debug("Block level 'silence' has been changed to 'silenced'")
block_level = "silenced"
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(cookies, dict):
raise TypeError(f"Parameter cookies[]='{type(cookies)}' is not of type 'dict'")
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif domain not in _cookies:
return []
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
has_cookies = domain in _cookies
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
if has(domain):
logger.debug("Removing cookies for domain='%s' ...", domain)
raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(url, str):
raise TypeError(f"Parameter url[]='{type(url)}' is not of type 'str'")
elif url == "":
raise ValueError("Parameter 'url' is empty")
elif not validators.url(url):
- raise ValueError(f"Parameter url='{url}' is not a valid URL")
+ raise RuntimeError(f"Parameter url='{url}' is not a valid URL but function was invoked")
punycode = encode_idna(domain)
logger.debug("punycode='%s'", punycode)
if not isinstance(response, requests.models.Response):
raise TypeError(f"Parameter response[]='{type(response)}' is not type of 'Response'")
elif not response.ok or response.status_code > 200:
- raise ValueError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
+ raise RuntimeError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
is_json = response.headers.get("content-type") is None or response.headers.get("content-type").split(";")[0] in ["*/*", "application/json", "application/jrd+json", "application/activity+json"]
if not isinstance(response, requests.models.Response):
raise TypeError(f"Parameter response[]='{type(response)}' is not type of 'Response'")
elif not response.ok or response.status_code > 200:
- raise ValueError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
+ raise RuntimeError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
elif response.text.strip() != "" and not is_json_response(response):
logger.warning("response.headers[content-type]='%s' is not a JSON type, below json() invocation may raise an exception", response.headers.get("content-type"))
elif command == "":
raise ValueError("Parameter 'command' is empty")
elif blacklist.is_blacklisted(blocked):
- raise ValueError(f"blocked='{blocked}' is blacklisted but function was invoked")
+ raise RuntimeError(f"blocked='{blocked}' is blacklisted but function was invoked")
elif blacklist.is_blacklisted(blocker):
- raise ValueError(f"blocker='{blocker}' is blacklisted but function was invoked")
+ raise RuntimeError(f"blocker='{blocker}' is blacklisted but function was invoked")
logger.debug("blocked='%s' - BEFORE!", blocked)
blocked = utils.deobfuscate(blocked, blocker)
elif block_level in ["reject", "suspend", "accept", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"Parameter block_level='{block_level}' is not supported")
elif blacklist.is_blacklisted(blocker):
- raise ValueError(f"blocker='{blocker}' is blacklisted but function was invoked")
+ raise RuntimeError(f"blocker='{blocker}' is blacklisted but function was invoked")
elif blacklist.is_blacklisted(blocked):
- raise ValueError(f"blocked='{blocked}' is blacklisted but function was invoked")
+ raise RuntimeError(f"blocked='{blocked}' is blacklisted but function was invoked")
added = False
if not blocks.is_instance_blocked(blocker, blocked, block_level):
elif command == "":
raise ValueError("Parameter 'command' is empty")
elif blacklist.is_blacklisted(blocker):
- raise ValueError(f"blocker='{blocker}' is blacklisted but function was invoked")
+ raise RuntimeError(f"blocker='{blocker}' is blacklisted but function was invoked")
logger.debug("Setting last_blocked for blocker='%s' ...", blocker)
instances.set_last_blocked(blocker)
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(headers, dict):
raise TypeError(f"Parameter headers[]='{type(headers)}' is not of type 'dict'")
elif path is not None and not path.startswith("/"):
raise ValueError(f"path='{path}' does not start with a slash")
elif _DEPTH > 0 and instances.is_recent(domain, "last_instance_fetch"):
- raise ValueError(f"domain='{domain}' has recently been fetched but function was invoked")
+ raise RuntimeError(f"domain='{domain}' has recently been fetched but function was invoked")
elif software is None and not instances.is_recent(domain, "last_instance_fetch"):
try:
logger.debug("Software for domain='%s',path='%s' is not set, determining ...", domain, path)
elif isinstance(software, str) and software == "":
raise ValueError("Parameter 'software' is empty")
elif software is not None and software_helper.is_relay(software):
- raise ValueError(f"domain='{domain}' is of software='{software}' and isn't supported here.")
+ raise RuntimeError(f"domain='{domain}' is of software='{software}' and isn't supported here.")
elif not isinstance(origin, str) and origin is not None:
raise TypeError(f"Parameter origin[]='{type(origin)}' is not of type 'str'")
elif isinstance(origin, str) and origin == "":
if blacklist.is_blacklisted(domain):
raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
# Init block list
blocklist = []
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(path, str):
raise TypeError(f"path[]='{type(path)}' is not of type 'str'")
elif path == "":
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(path, str):
raise TypeError(f"path[]='{type(path)}' is not of type 'str'")
elif path == "":
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(blocklist, list):
raise TypeError(f"Parameter blocklist[]='{type(blocklist)}' is not of type 'list'")
elif len(blocklist) == 0:
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(path, str):
raise TypeError(f"Parameter path[]='{type(path)}' is not of type 'str'")
elif path == "":
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(path, str):
raise TypeError(f"Parameter path[]='{type(path)}' is not of type 'str'")
elif path == "":
elif blacklist.is_blacklisted(blocked):
raise RuntimeError(f"blocked='{blocked}' is blacklisted but function invoked")
elif not is_instance_blocked(blocker, blocked, block_level):
- raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function is invoked")
+ raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function was invoked")
database.cursor.execute(
"SELECT reason FROM blocks WHERE blocker = ? AND blocked = ? AND block_level = ? LIMIT 1",
elif blacklist.is_blacklisted(blocked):
raise RuntimeError(f"blocked='{blocked}' is blacklisted but function invoked")
elif not is_instance_blocked(blocker, blocked, block_level):
- raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function is invoked")
+ raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function was invoked")
logger.debug("Updating block reason='%s',blocker='%s',blocked='%s',block_level='%s'", reason, blocker, blocked, block_level)
database.cursor.execute(
elif blacklist.is_blacklisted(blocked):
raise RuntimeError(f"blocked='{blocked}' is blacklisted but function invoked")
elif not is_instance_blocked(blocker, blocked, block_level):
- raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function is invoked")
+ raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function was invoked")
database.cursor.execute(
"UPDATE blocks SET last_seen = ? WHERE blocker = ? AND blocked = ? AND block_level = ? LIMIT 1",
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not _write_error_log:
raise RuntimeError("Logging of errors is disabled but function was invoked")
domain_helper.raise_on(domain)
if not is_registered(domain):
- raise ValueError(f"domain='{domain}' is not registered but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
elif blacklist.is_blacklisted(domain):
raise RuntimeError(f"domain='{domain}' is blacklisted but function has been invoked")
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
blocklist = []
block_tag = None
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
# No CSRF by default, you don't have to add network.api_headers by yourself here
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
blocklist = []
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
peers = []
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
# Init variables
doc = None
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
# Init variables
blocklist = []
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
logger.debug("domain='%s' is misskey, sending API POST request ...", domain)
peers = []
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
# No CSRF by default, you don't have to add network.api_headers by yourself here
headers = {}
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
# Init variables
peers = []
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
# Init variables
blockdict = []
domain_helper.raise_on(domain)
if blacklist.is_blacklisted(domain):
- raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not instances.is_registered(domain):
- raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+ raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
# Init variables
doc = None
domain_helper.raise_on(blocker)
if validators.domain(domain, rfc_2782=True) and blacklist.is_blacklisted(domain):
- raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(domain_hash, str) and domain_hash is not None:
raise TypeError(f"Parameter domain_hash[]='{type(domain_hash)}' is not of type 'str'")
elif domain_hash == "":