Parcourir la source

Fixing KeyError

Foppe Hemminga il y a 6 ans
Parent
commit
8e051fc036
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      main.py

+ 1 - 1
main.py

@@ -66,7 +66,7 @@ if __name__ == '__main__':
             if 'alert' in temp_status_json:
             if 'alert' in temp_status_json:
                 alerts = temp_status_json['alert']
                 alerts = temp_status_json['alert']
             else:
             else:
-                alerts = {'15': False, '10': False, '5': False, '1': False}
+                temp_status_json['alert'] = {'15': False, '10': False, '5': False, '1': False}
             if not alerts[str(minutes_to_go)]:
             if not alerts[str(minutes_to_go)]:
                 # We have not sent this alert before
                 # We have not sent this alert before
                 name_alert = status['name']
                 name_alert = status['name']