From 0300a436b154ce028738a4613b39de919f66862a Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 31 Jul 2024 19:23:22 +0300 Subject: [PATCH] Fix(bkmk_robot_base): Do not pass `localhost` via proxy --- Robots/bkmk_robot_base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Robots/bkmk_robot_base.py b/Robots/bkmk_robot_base.py index 90d2875..86f05d0 100644 --- a/Robots/bkmk_robot_base.py +++ b/Robots/bkmk_robot_base.py @@ -339,9 +339,12 @@ class robot_base(Robot): error, http_status_code, redirect_to, headers, content = \ self.get(bookmark, url, accept_charset=accept_charset) - if error is not None: + if error is not None and ( + not url_host.startswith('localhost') and + not url_host.startswith('127.') + ): self.log(' Error : %s' % error) - if self.proxy and error != '404 not_found': + if self.proxy and http_status_code != 404: self.log(' Retrying with the proxy...') error, http_status_code, redirect_to, headers, content = \ self.get(bookmark, url, -- 2.39.5