Récupérer la météo et l'envoyer par Gotify Le but de ce projet est avant-tout de tester Gotify et voir s'il peut potentiellement remplacer Telegram dans la plupart de mes projets qui nécessitent des notifications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

run.py 706 B

1234567891011121314151617181920212223242526272829
  1. from gotify import send_notification_for_tomorrow, send_notification_for_today, send_notif
  2. import datetime
  3. import time
  4. def main():
  5. while True :
  6. now = datetime.datetime.now()
  7. print(type(now.hour))
  8. while now.hour % 9 != 0 :
  9. print(f"Il est {now.hour}H")
  10. now = datetime.datetime.now()
  11. time.sleep(600)
  12. if now.hour == 9 :
  13. send_notification_for_today()
  14. elif now.hour == 18 :
  15. send_notification_for_tomorrow()
  16. time.sleep(3600)
  17. if __name__ == '__main__':
  18. try :
  19. main()
  20. except :
  21. send_notif("Erreur", "Une erreur s'est produite durant l'execution du script")
  22. main()