Advertisement
Guest User

Untitled

a guest
Nov 10th, 2023
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. import apprise
  2. import threading
  3. import schedule
  4.  
  5. def SendNotification(serviceString, message):
  6.     sleep(1.5)
  7.     apobj = apprise.Apprise()
  8.     apobj.add(serviceString)
  9.     apobj.notify(body=message['body'], title=message['title'])
  10.     sleep(5)
  11. def Get_Missing_List():
  12.     pass
  13. def Download():
  14.     global appriseServiceString
  15.     if Done:
  16.         SendNotification(appriseServiceString, {"body": f"body_text_here", "title": "title_here"})
  17.     pass
  18. def Tasks():
  19.     schedule.every(30).minutes.do(Get_Missing_List)
  20.     schedule.every(59).minutes.do(Download)
  21.     while True:
  22.         schedule.run_pending()
  23.         sleep(10)
  24. def Main():
  25.     Tasker_thread = threading.Thread(target=Tasks, daemon=False)
  26.     Tasker_thread.start()
  27.  
  28. appriseServiceString = 'gotifys://ip_address_or_domain/token?priority=high' #or use env var in docker-compose then appriseServiceString = os.environ['APPRISE_SERVICE_STRING']
  29.  
  30. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement