From 439d8a0b81993e382638e8bb548bc44dd417626e Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 24 Aug 2022 09:26:14 +0200 Subject: [PATCH] not needed --- changedetectionio/__init__.py | 2 +- changedetectionio/fetch_site_status.py | 12 +++++------- changedetectionio/store.py | 4 ---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 509bc6f9..30306208 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -503,7 +503,7 @@ def changedetection_app(config=None, datastore_o=None): from changedetectionio import fetch_site_status # Get the most recent one - newest_history_key = datastore.get_val(uuid, 'newest_history_key') + newest_history_key = datastore.data['watching'][uuid].get('newest_history_key') # 0 means that theres only one, so that there should be no 'unviewed' history available if newest_history_key == 0: diff --git a/changedetectionio/fetch_site_status.py b/changedetectionio/fetch_site_status.py index bee0d50c..ed84c0fd 100644 --- a/changedetectionio/fetch_site_status.py +++ b/changedetectionio/fetch_site_status.py @@ -63,13 +63,11 @@ class perform_site_check(): def run(self, uuid): - timestamp = int(time.time()) # used for storage etc too - changed_detected = False screenshot = False # as bytes stripped_text_from_html = "" - watch = self.datastore.data['watching'][uuid] + watch = self.datastore.data['watching'].get(uuid) # Protect against file:// access if re.search(r'^file', watch['url'], re.IGNORECASE) and not os.getenv('ALLOW_FILE_URI', False): @@ -80,7 +78,7 @@ class perform_site_check(): # Unset any existing notification error update_obj = {'last_notification_error': False, 'last_error': False} - extra_headers = self.datastore.get_val(uuid, 'headers') + extra_headers =self.datastore.data['watching'][uuid].get('headers') # Tweak the base config with the per-watch ones request_headers = self.datastore.data['settings']['headers'].copy() @@ -93,9 +91,9 @@ class perform_site_check(): request_headers['Accept-Encoding'] = request_headers['Accept-Encoding'].replace(', br', '') timeout = self.datastore.data['settings']['requests']['timeout'] - url = self.datastore.get_val(uuid, 'url') - request_body = self.datastore.get_val(uuid, 'body') - request_method = self.datastore.get_val(uuid, 'method') + url = watch.get('url') + request_body = self.datastore.data['watching'][uuid].get('body') + request_method = self.datastore.data['watching'][uuid].get('method') ignore_status_codes = self.datastore.data['watching'][uuid].get('ignore_status_codes', False) # source: support diff --git a/changedetectionio/store.py b/changedetectionio/store.py index 00e568df..80cac7a4 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -244,10 +244,6 @@ class ChangeDetectionStore: return False - def get_val(self, uuid, val): - # Probably their should be dict... - return self.data['watching'][uuid].get(val) - # Remove a watchs data but keep the entry (URL etc) def clear_watch_history(self, uuid): import pathlib