mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-08 18:47:32 +00:00
Compare commits
2 Commits
default-na
...
notificati
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a357c82e6f | ||
|
|
d4559886b1 |
@@ -1267,7 +1267,7 @@ def notification_runner():
|
|||||||
try:
|
try:
|
||||||
from changedetectionio import notification
|
from changedetectionio import notification
|
||||||
|
|
||||||
notification.process_notification(n_object, datastore)
|
sent_obj = notification.process_notification(n_object, datastore)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Watch URL: {} Error {}".format(n_object['watch_url'], str(e)))
|
logging.error("Watch URL: {} Error {}".format(n_object['watch_url'], str(e)))
|
||||||
@@ -1281,7 +1281,7 @@ def notification_runner():
|
|||||||
notification_debug_log += log_lines
|
notification_debug_log += log_lines
|
||||||
|
|
||||||
# Process notifications
|
# Process notifications
|
||||||
notification_debug_log+= ["{} - SENDING {}".format(now.strftime("%Y/%m/%d %H:%M:%S,000"), json.dumps(n_object))]
|
notification_debug_log+= ["{} - SENDING - {}".format(now.strftime("%Y/%m/%d %H:%M:%S,000"), json.dumps(sent_obj))]
|
||||||
# Trim the log length
|
# Trim the log length
|
||||||
notification_debug_log = notification_debug_log[-100:]
|
notification_debug_log = notification_debug_log[-100:]
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ def process_notification(n_object, datastore):
|
|||||||
if log_value and 'WARNING' in log_value or 'ERROR' in log_value:
|
if log_value and 'WARNING' in log_value or 'ERROR' in log_value:
|
||||||
raise Exception(log_value)
|
raise Exception(log_value)
|
||||||
|
|
||||||
|
# Return what was sent for better logging
|
||||||
|
return {'title': n_title,
|
||||||
|
'body': n_body,
|
||||||
|
'body_format': n_format}
|
||||||
|
|
||||||
|
|
||||||
# Notification title + body content parameters get created here.
|
# Notification title + body content parameters get created here.
|
||||||
|
|||||||
@@ -154,6 +154,10 @@ def test_check_notification(client, live_server):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
assert os.path.exists("test-datastore/notification.txt") == False
|
assert os.path.exists("test-datastore/notification.txt") == False
|
||||||
|
|
||||||
|
res = client.get(url_for("notification_logs"))
|
||||||
|
# be sure we see it in the output log
|
||||||
|
assert b'New ChangeDetection.io Notification - ' + test_url.encode('utf-8') in res.data
|
||||||
|
|
||||||
# cleanup for the next
|
# cleanup for the next
|
||||||
client.get(
|
client.get(
|
||||||
url_for("form_delete", uuid="all"),
|
url_for("form_delete", uuid="all"),
|
||||||
|
|||||||
Reference in New Issue
Block a user