mirror of
https://github.com/unixtensor/proxmox-ntfy.git
synced 2025-06-28 03:28:05 +00:00
16 lines
412 B
Python
16 lines
412 B
Python
import subprocess
|
|
import main
|
|
import time
|
|
|
|
last_ntfy_send: float = time.time()
|
|
|
|
def send(message: str):
|
|
try:
|
|
if main.ntfy_url:
|
|
global last_ntfy_send
|
|
last_ntfy_send = time.time()
|
|
subprocess.run(["curl", "-d", f"\"{message}\"", main.ntfy_url], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
else:
|
|
print("Ntfy send: url is not configured.")
|
|
except Exception as err:
|
|
print(f"Ntfy failed. {err}") |