mirror of
https://github.com/FAUSheppy/atlantis-event-dispatcher
synced 2025-12-06 06:21:36 +01:00
Compare commits
3 Commits
178ba5451d
...
f2137e7e4c
| Author | SHA1 | Date | |
|---|---|---|---|
| f2137e7e4c | |||
| c577802e63 | |||
| 2a74d9816f |
@@ -57,6 +57,12 @@ def ntfy_api_get_topic(ntfy_api_server, ntfy_api_token, username):
|
||||
def ntfy_send(dispatch_uuid, user_topic, title, message, ntfy_push_target, ntfy_user, ntfy_pass):
|
||||
'''Send message via NTFY topic'''
|
||||
|
||||
# limit message length and title #
|
||||
title = title or ""
|
||||
message = message or ""
|
||||
message = message[:1024]
|
||||
title = title[:512]
|
||||
|
||||
if not user_topic:
|
||||
report_failed_dispatch(dispatch_uuid, "No user topic")
|
||||
return
|
||||
@@ -78,6 +84,9 @@ def ntfy_send(dispatch_uuid, user_topic, title, message, ntfy_push_target, ntfy_
|
||||
# send #
|
||||
r = requests.post(ntfy_push_target, auth=(ntfy_user, ntfy_pass), json=payload)
|
||||
print(r.status_code, r.text, payload)
|
||||
if r.status_code == 429: # rate-limit
|
||||
time.sleep(60)
|
||||
|
||||
r.raise_for_status()
|
||||
|
||||
# talk to dispatch #
|
||||
|
||||
Reference in New Issue
Block a user