mirror of
https://github.com/unixtensor/proxmox-ntfy.git
synced 2025-06-28 13:08:05 +00:00
Split everything into modules
This commit is contained in:
16
src/ntfy.py
Normal file
16
src/ntfy.py
Normal file
@ -0,0 +1,16 @@
|
||||
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}")
|
Reference in New Issue
Block a user