New feature - Helper button to trigger a scan/access test of all proxies for a particular watch (#1685)

This commit is contained in:
dgtlmoon
2023-07-10 16:08:45 +02:00
committed by GitHub
parent 20d65cdd26
commit 1987e109e8
10 changed files with 271 additions and 30 deletions

View File

@@ -9,7 +9,7 @@ class difference_detection_processor():
super().__init__(*args, **kwargs)
@abstractmethod
def run(self, uuid, skip_when_checksum_same=True):
def run(self, uuid, skip_when_checksum_same=True, preferred_proxy=None):
update_obj = {'last_notification_error': False, 'last_error': False}
some_data = 'xxxxx'
update_obj["previous_md5"] = hashlib.md5(some_data.encode('utf-8')).hexdigest()

View File

@@ -50,7 +50,7 @@ class perform_site_check(difference_detection_processor):
return regex
def run(self, uuid, skip_when_checksum_same=True):
def run(self, uuid, skip_when_checksum_same=True, preferred_proxy=None):
changed_detected = False
screenshot = False # as bytes
stripped_text_from_html = ""
@@ -105,7 +105,11 @@ class perform_site_check(difference_detection_processor):
# If the klass doesnt exist, just use a default
klass = getattr(content_fetcher, "html_requests")
proxy_id = self.datastore.get_preferred_proxy_for_watch(uuid=uuid)
if preferred_proxy:
proxy_id = preferred_proxy
else:
proxy_id = self.datastore.get_preferred_proxy_for_watch(uuid=uuid)
proxy_url = None
if proxy_id:
proxy_url = self.datastore.proxy_list.get(proxy_id).get('url')