From 1f9bbef021d86a036e58581791bae19a2e03c8ec Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 31 Jan 2024 12:36:25 +0100 Subject: [PATCH] Record the remote server reply header --- changedetectionio/update_worker.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/changedetectionio/update_worker.py b/changedetectionio/update_worker.py index 469ee6ca..4d401861 100644 --- a/changedetectionio/update_worker.py +++ b/changedetectionio/update_worker.py @@ -491,6 +491,17 @@ class update_worker(threading.Thread): if self.datastore.data['watching'].get(uuid): # Always record that we atleast tried count = self.datastore.data['watching'][uuid].get('check_count', 0) + 1 + + # Record the 'server' header reply, can be used for actions in the future like cloudflare/akamai workarounds + try: + self.datastore.update_watch(uuid=uuid, + update_obj={ + 'remote_server_reply': update_handler.fetcher.headers.get('server', '').lower() + } + ) + except Exception as e: + pass + self.datastore.update_watch(uuid=uuid, update_obj={'fetch_time': round(time.time() - now, 3), 'last_checked': round(time.time()), 'check_count': count