From: Roland Häder Date: Mon, 17 Jul 2023 13:47:09 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6b99a9826480e7c57d8b988478e269aa61731023;p=fba.git Continued: - log returned empty lists separately from warning (mostly caught exception) --- diff --git a/fba/http/federation.py b/fba/http/federation.py index ae01d1f..062a486 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -182,8 +182,10 @@ def fetch_peers(domain: str, software: str, origin: str) -> list: logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: - logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s) - EXIT!", type(exception), __name__) + logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s)", type(exception), __name__) instances.set_last_error(domain, exception) + + logger.debug("Returning empty list ... - EXIT!") return list() paths = [ diff --git a/fba/networks/friendica.py b/fba/networks/friendica.py index b4cded1..96c2508 100644 --- a/fba/networks/friendica.py +++ b/fba/networks/friendica.py @@ -57,11 +57,13 @@ def fetch_blocks(domain: str) -> list: except network.exceptions as exception: logger.warning("Exception '%s' during fetching instances from domain='%s'", type(exception), domain) instances.set_last_error(domain, exception) + + logger.debug("Returning empty list ... - EXIT!") return list() logger.debug("block_tag[%s]='%s'", type(block_tag), block_tag) if block_tag is None: - logger.debug("Instance has no block list: domain='%s'", domain) + logger.debug("Instance has no block list: domain='%s' - EXIT!", domain) return list() table = block_tag.find("table") diff --git a/fba/networks/lemmy.py b/fba/networks/lemmy.py index 0b22f53..42c4eb4 100644 --- a/fba/networks/lemmy.py +++ b/fba/networks/lemmy.py @@ -48,8 +48,10 @@ def fetch_peers(domain: str, origin: str) -> list: logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: - logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s) - EXIT!", type(exception), __name__) + logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s)", type(exception), __name__) instances.set_last_error(domain, exception) + + logger.debug("Returning empty list ... - EXIT!") return list() try: @@ -325,7 +327,7 @@ def parse_script(doc: bs4.BeautifulSoup, only: str = None) -> list: try: parsed = json.loads(iso_data) except json.decoder.JSONDecodeError as exception: - logger.warning("Exception '%s' during parsing %d Bytes: '%s'", type(exception), len(iso_data), str(exception)) + logger.warning("Exception '%s' during parsing %d Bytes: '%s' - EXIT!", type(exception), len(iso_data), str(exception)) return list() logger.debug("parsed[%s]()=%d", type(parsed), len(parsed)) diff --git a/fba/networks/mastodon.py b/fba/networks/mastodon.py index 1e6a20b..3681176 100644 --- a/fba/networks/mastodon.py +++ b/fba/networks/mastodon.py @@ -145,8 +145,10 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list: logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: - logger.warning("Exception '%s' during checking CSRF (fetch_blocks,%s) - EXIT!", type(exception), __name__) + logger.warning("Exception '%s' during checking CSRF (fetch_blocks,%s)", type(exception), __name__) instances.set_last_error(domain, exception) + + logger.debug("Returning empty list ... - EXIT!") return list() try: diff --git a/fba/networks/misskey.py b/fba/networks/misskey.py index 35eff0b..ec35833 100644 --- a/fba/networks/misskey.py +++ b/fba/networks/misskey.py @@ -48,8 +48,10 @@ def fetch_peers(domain: str) -> list: logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: - logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s) - EXIT!", type(exception), __name__) + logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s)", type(exception), __name__) instances.set_last_error(domain, exception) + + logger.debug("Returning empty list ... - EXIT!") return list() # iterating through all "suspended" (follow-only in its terminology) @@ -134,8 +136,10 @@ def fetch_blocks(domain: str) -> list: logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: - logger.warning("Exception '%s' during checking CSRF (fetch_blocks,%s) - EXIT!", type(exception), __name__) + logger.warning("Exception '%s' during checking CSRF (fetch_blocks,%s)", type(exception), __name__) instances.set_last_error(domain, exception) + + logger.debug("Returning empty list ... - EXIT!") return list() blocklist = list() diff --git a/fba/networks/peertube.py b/fba/networks/peertube.py index 7dc41cb..951e263 100644 --- a/fba/networks/peertube.py +++ b/fba/networks/peertube.py @@ -43,8 +43,10 @@ def fetch_peers(domain: str) -> list: logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: - logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s) - EXIT!", type(exception), __name__) + logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s)", type(exception), __name__) instances.set_last_error(domain, exception) + + logger.debug("Returning empty list ... - EXIT!") return list() for mode in ["followers", "following"]: diff --git a/fba/networks/pleroma.py b/fba/networks/pleroma.py index e49473f..fbe03da 100644 --- a/fba/networks/pleroma.py +++ b/fba/networks/pleroma.py @@ -66,8 +66,10 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list: rows = federation.fetch_nodeinfo(domain, nodeinfo_url) if "error_message" in rows: - logger.warning("Error message '%s' during fetching nodeinfo for domain='%s',nodeinfo_url='%s' - EXIT!", rows["error_message"], domain, nodeinfo_url) + logger.warning("Error message '%s' during fetching nodeinfo for domain='%s',nodeinfo_url='%s'", rows["error_message"], domain, nodeinfo_url) instances.set_last_error(domain, rows) + + logger.debug("Returning empty list ... - EXIT!") return list() elif "exception" in rows: logger.warning("Exception '%s' during fetching nodeinfo for domain='%s',nodeinfo_url='%s' - EXIT!", type(rows["exception"]), domain, nodeinfo_url) @@ -75,18 +77,19 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list: elif "json" in rows: logger.debug("rows[json] found for domain='%s',nodeinfo_url='%s'", domain, nodeinfo_url) rows = rows["json"] + except network.exceptions as exception: logger.warning("Exception '%s' during fetching nodeinfo from domain='%s'", type(exception), domain) instances.set_last_error(domain, exception) if rows is None: - logger.warning("Could not fetch nodeinfo from domain='%s'", domain) + logger.warning("Could not fetch nodeinfo from domain='%s' - EXIT!", domain) return list() elif "metadata" not in rows: - logger.warning("rows()=%d does not have key 'metadata', domain='%s'", len(rows), domain) + logger.warning("rows()=%d does not have key 'metadata', domain='%s' - EXIT!", len(rows), domain) return list() elif "federation" not in rows["metadata"]: - logger.warning("rows()=%d does not have key 'federation', domain='%s'", len(rows["metadata"]), domain) + logger.warning("rows()=%d does not have key 'federation', domain='%s' - EXIT!", len(rows["metadata"]), domain) return list() data = rows["metadata"]["federation"]