]> git.phdru.name Git - bookmarks_db.git/commitdiff
Fix(bkmk_robot_base): Fix reporting proxy error
authorOleg Broytman <phd@phdru.name>
Thu, 1 Aug 2024 16:10:30 +0000 (19:10 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 1 Aug 2024 16:10:30 +0000 (19:10 +0300)
Robots/bkmk_robot_base.py

index 9b989e5f70ee4d1035721677fbfc99cd759dd78a..26a0fec10a45c6f58ab554576a6c41630dae7f78 100644 (file)
@@ -337,7 +337,9 @@ class robot_base(Robot):
         if url_host in self.proxy_error:
             return 'see prev. error', None, None, None, None
 
+        use_proxy = False
         if url_host in self.proxy_ok:
+            use_proxy = True
             self.log('   Immediately trying with the proxy')
             error, http_status_code, redirect_to, headers, content = \
                 self.get(bookmark, url,
@@ -353,6 +355,7 @@ class robot_base(Robot):
             ):
                 self.log('   Error          : %s' % error)
                 if self.proxy and http_status_code != 404:
+                    use_proxy = True
                     self.log('   Retrying with the proxy...')
                     error, http_status_code, redirect_to, headers, content = \
                         self.get(bookmark, url,
@@ -361,7 +364,7 @@ class robot_base(Robot):
                     if error is None:
                         self.proxy_ok.add(url_host)
         if error is not None:
-            if self.proxy and http_status_code != 404:
+            if use_proxy:
                 self.log('   Proxy error    : %s' % error)
                 if url_host not in self.proxy_ok:
                     self.proxy_error.add(url_host)