From 6e41e70ef835af1b53d501294f9a828ffa5bd005 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 5 Sep 2023 01:15:53 +0200 Subject: [PATCH] Continued: - no need for double-fetching generic JSON API --- fba/networks/mastodon.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fba/networks/mastodon.py b/fba/networks/mastodon.py index f0de5de..88fd35f 100644 --- a/fba/networks/mastodon.py +++ b/fba/networks/mastodon.py @@ -66,7 +66,7 @@ def fetch_blocks_from_about(domain: str) -> dict: if not instances.is_registered(domain): raise Exception(f"domain='{domain}' is not registered but function is invoked.") - logger.debug("Fetching mastodon blocks from domain='%s'", domain) + logger.info("Fetching mastodon blocks from domain='%s'", domain) doc = None for path in ["/about/more", "/about"]: try: @@ -153,13 +153,8 @@ def fetch_blocks(domain: str) -> list: blocklist = list() - logger.debug("Invoking federation.fetch_blocks(%s) ...", domain) - rows = federation.fetch_blocks(domain) - - logger.debug("rows[%s]()=%d", type(rows), len(rows)) - if len(rows) == 0: - logger.debug("domain='%s' has returned zero rows, trying /about/more page ...", domain) - rows = fetch_blocks_from_about(domain) + logger.debug("Invoking fetch_blocks_from_about(%s) ...", domain) + rows = fetch_blocks_from_about(domain) logger.debug("rows[%s]()=%d", type(rows), len(rows)) if len(rows) > 0: -- 2.39.5