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
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

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