]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 17 Jul 2023 13:24:30 +0000 (15:24 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 17 Jul 2023 13:24:30 +0000 (15:24 +0200)
- rewrote a bit for better logging
- also don't nest function/method invocations, they are not easy to debug

fba/networks/friendica.py

index e3fdb7111fb743a15bdb3b7e8310e6b3824607e9..b4cded19afdaea402933dc34483e07b60bc4ddcc 100644 (file)
@@ -41,24 +41,25 @@ def fetch_blocks(domain: str) -> list:
 
     try:
         logger.debug("Fetching friendica blocks from domain='%s'", domain)
-        doc = bs4.BeautifulSoup(
-            network.fetch_response(
-                domain,
-                "/friendica",
-                network.web_headers,
-                (config.get("connection_timeout"), config.get("read_timeout"))
-            ).text,
-            "html.parser",
-        )
+        raw = network.fetch_response(
+            domain,
+            "/friendica",
+            network.web_headers,
+            (config.get("connection_timeout"), config.get("read_timeout"))
+        ).text
+        logger.debug("Parsing %d Bytes ...", len(raw))
+
+        doc = bs4.BeautifulSoup(raw, "html.parser",)
         logger.debug("doc[]='%s'", type(doc))
 
         block_tag = doc.find(id="about_blocklist")
+        logger.debug("block_tag[%s]='%s'", type(block_tag), block_tag)
     except network.exceptions as exception:
         logger.warning("Exception '%s' during fetching instances from domain='%s'", type(exception), domain)
         instances.set_last_error(domain, exception)
         return list()
 
-    # Prevents exceptions:
+    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)
         return list()