mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-22 17:36:09 +00:00
Compare commits
4 Commits
browserste
...
0.45.10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
764514e5eb | ||
|
|
ad3ffb6ccb | ||
|
|
e051b29bf2 | ||
|
|
126852b778 |
@@ -98,7 +98,7 @@ Please :star: star :star: this project and help it grow! https://github.com/dgtl
|
|||||||
With Docker composer, just clone this repository and..
|
With Docker composer, just clone this repository and..
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker-compose up -d
|
$ docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
Docker standalone
|
Docker standalone
|
||||||
@@ -137,10 +137,10 @@ docker rm $(docker ps -a -f name=changedetection.io -q)
|
|||||||
docker run -d --restart always -p "127.0.0.1:5000:5000" -v datastore-volume:/datastore --name changedetection.io dgtlmoon/changedetection.io
|
docker run -d --restart always -p "127.0.0.1:5000:5000" -v datastore-volume:/datastore --name changedetection.io dgtlmoon/changedetection.io
|
||||||
```
|
```
|
||||||
|
|
||||||
### docker-compose
|
### docker compose
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose pull && docker-compose up -d
|
docker compose pull && docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
See the wiki for more information https://github.com/dgtlmoon/changedetection.io/wiki
|
See the wiki for more information https://github.com/dgtlmoon/changedetection.io/wiki
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Read more https://github.com/dgtlmoon/changedetection.io/wiki
|
# Read more https://github.com/dgtlmoon/changedetection.io/wiki
|
||||||
|
|
||||||
__version__ = '0.45.9'
|
__version__ = '0.45.10'
|
||||||
|
|
||||||
from distutils.util import strtobool
|
from distutils.util import strtobool
|
||||||
from json.decoder import JSONDecodeError
|
from json.decoder import JSONDecodeError
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ class JSActionExceptions(Exception):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class BrowserStepsStepTimout(Exception):
|
class BrowserStepsStepException(Exception):
|
||||||
def __init__(self, step_n):
|
def __init__(self, step_n, original_e):
|
||||||
self.step_n = step_n
|
self.step_n = step_n
|
||||||
|
self.original_e = original_e
|
||||||
|
print(f"Browser Steps exception at step {self.step_n}", str(original_e))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@@ -173,7 +175,7 @@ class Fetcher():
|
|||||||
|
|
||||||
def iterate_browser_steps(self):
|
def iterate_browser_steps(self):
|
||||||
from changedetectionio.blueprint.browser_steps.browser_steps import steppable_browser_interface
|
from changedetectionio.blueprint.browser_steps.browser_steps import steppable_browser_interface
|
||||||
from playwright._impl._errors import TimeoutError
|
from playwright._impl._errors import TimeoutError, Error
|
||||||
from jinja2 import Environment
|
from jinja2 import Environment
|
||||||
jinja2_env = Environment(extensions=['jinja2_time.TimeExtension'])
|
jinja2_env = Environment(extensions=['jinja2_time.TimeExtension'])
|
||||||
|
|
||||||
@@ -203,10 +205,10 @@ class Fetcher():
|
|||||||
optional_value=optional_value)
|
optional_value=optional_value)
|
||||||
self.screenshot_step(step_n)
|
self.screenshot_step(step_n)
|
||||||
self.save_step_html(step_n)
|
self.save_step_html(step_n)
|
||||||
except TimeoutError as e:
|
|
||||||
print(str(e))
|
except (Error, TimeoutError) as e:
|
||||||
# Stop processing here
|
# Stop processing here
|
||||||
raise BrowserStepsStepTimout(step_n=step_n)
|
raise BrowserStepsStepException(step_n=step_n, original_e=e)
|
||||||
|
|
||||||
# It's always good to reset these
|
# It's always good to reset these
|
||||||
def delete_browser_steps_screenshots(self):
|
def delete_browser_steps_screenshots(self):
|
||||||
|
|||||||
@@ -188,9 +188,9 @@ class update_worker(threading.Thread):
|
|||||||
return
|
return
|
||||||
threshold = self.datastore.data['settings']['application'].get('filter_failure_notification_threshold_attempts')
|
threshold = self.datastore.data['settings']['application'].get('filter_failure_notification_threshold_attempts')
|
||||||
n_object = {'notification_title': "Changedetection.io - Alert - Browser step at position {} could not be run".format(step_n+1),
|
n_object = {'notification_title': "Changedetection.io - Alert - Browser step at position {} could not be run".format(step_n+1),
|
||||||
'notification_body': "Your configured browser step at position {} for {{watch['url']}} "
|
'notification_body': "Your configured browser step at position {} for {{{{watch_url}}}} "
|
||||||
"did not appear on the page after {} attempts, did the page change layout? "
|
"did not appear on the page after {} attempts, did the page change layout? "
|
||||||
"Does it need a delay added?\n\nLink: {{base_url}}/edit/{{watch_uuid}}\n\n"
|
"Does it need a delay added?\n\nLink: {{{{base_url}}}}/edit/{{{{watch_uuid}}}}\n\n"
|
||||||
"Thanks - Your omniscient changedetection.io installation :)\n".format(step_n+1, threshold),
|
"Thanks - Your omniscient changedetection.io installation :)\n".format(step_n+1, threshold),
|
||||||
'notification_format': 'text'}
|
'notification_format': 'text'}
|
||||||
|
|
||||||
@@ -354,20 +354,32 @@ class update_worker(threading.Thread):
|
|||||||
changed_detected = False
|
changed_detected = False
|
||||||
self.datastore.update_watch(uuid=uuid, update_obj={'last_error': False})
|
self.datastore.update_watch(uuid=uuid, update_obj={'last_error': False})
|
||||||
|
|
||||||
except content_fetcher.BrowserStepsStepTimout as e:
|
except content_fetcher.BrowserStepsStepException as e:
|
||||||
|
|
||||||
if not self.datastore.data['watching'].get(uuid):
|
if not self.datastore.data['watching'].get(uuid):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
error_step = e.step_n + 1
|
error_step = e.step_n + 1
|
||||||
err_text = f"Warning, browser step at position {error_step} could not run, target not found, check the watch, add a delay if necessary, view Browser Steps to see screenshot at that step"
|
from playwright._impl._errors import TimeoutError, Error
|
||||||
|
|
||||||
|
# Generally enough info for TimeoutError (couldnt locate the element after default seconds)
|
||||||
|
err_text = f"Browser step at position {error_step} could not run, check the watch, add a delay if necessary, view Browser Steps to see screenshot at that step."
|
||||||
|
|
||||||
|
if e.original_e.name == "TimeoutError":
|
||||||
|
# Just the first line is enough, the rest is the stack trace
|
||||||
|
err_text += " Could not find the target."
|
||||||
|
else:
|
||||||
|
# Other Error, more info is good.
|
||||||
|
err_text += " " + str(e.original_e).splitlines()[0]
|
||||||
|
|
||||||
|
print(f"BrowserSteps exception at step {error_step}", str(e.original_e))
|
||||||
|
|
||||||
self.datastore.update_watch(uuid=uuid,
|
self.datastore.update_watch(uuid=uuid,
|
||||||
update_obj={'last_error': err_text,
|
update_obj={'last_error': err_text,
|
||||||
'browser_steps_last_error_step': error_step
|
'browser_steps_last_error_step': error_step
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if self.datastore.data['watching'][uuid].get('filter_failure_notification_send', False):
|
if self.datastore.data['watching'][uuid].get('filter_failure_notification_send', False):
|
||||||
c = self.datastore.data['watching'][uuid].get('consecutive_filter_failures', 5)
|
c = self.datastore.data['watching'][uuid].get('consecutive_filter_failures', 5)
|
||||||
c += 1
|
c += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user