]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 4 Jul 2023 14:49:13 +0000 (16:49 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 4 Jul 2023 14:49:13 +0000 (16:49 +0200)
- try to "crawl" instances being redirected to

fba/http/federation.py

index c7c2fd8c92932fa50efbd812adef8f0df23ed604..845d46af8e3430dfefc7280d2244898b38cc7639 100644 (file)
@@ -448,11 +448,20 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
                 instances.set_detection_mode(domain, "PLATFORM")
     elif not domain_helper.is_in_url(domain, response.url):
         logger.warning("domain='%s' doesn't match response.url='%s', maybe redirect to other domain?", domain, response.url)
+
+        components = urlparse(response.url)
+
+        log.debug("components[]='%s'", type(components))
+        if not instances.is_registered(components.netloc):
+            logger.info("components.netloc='%s' is not registered, adding ...", components.netloc)
+            fetch_instances(components.netloc, domain, None, "fetch_generator")
+
         message = f"Redirect from domain='{domain}' to response.url='{response.url}'"
         instances.set_last_error(domain, message)
         instances.set_software(domain, None)
         instances.set_detection_mode(domain, None)
         instances.set_nodeinfo_url(domain, None)
+
         raise requests.exceptions.TooManyRedirects(message)
 
     logger.debug("software[]='%s'", type(software))