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
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
706 B

  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()