Fix parser crash if info key does not exist
這個提交存在於:
父節點
0cf69f9ff9
當前提交
b4c1e0fcaf
共有 1 個檔案被更改,包括 3 行新增 和 1 行删除
|
|
@ -73,13 +73,15 @@ def get_json(code: str, file: TextIO):
|
|||
print("Error reading file " + file.name)
|
||||
print(e)
|
||||
|
||||
if not ("info" in file_json):
|
||||
file_json["info"] = {}
|
||||
|
||||
info = file_json["info"]
|
||||
if not ("last_checked" in info) or info[
|
||||
"last_checked"] < datetime.now().timestamp() * 1000 - CUSTOM_MESSAGE_INTERVAL:
|
||||
print("Updating proxiwash message")
|
||||
info["message"] = get_message(code)
|
||||
info["last_checked"] = datetime.now().timestamp() * 1000
|
||||
|
||||
parsed_data = get_machines(code)
|
||||
file_json["dryers"] = parsed_data["dryers"]
|
||||
file_json["washers"] = parsed_data["washers"]
|
||||
|
|
|
|||
載入中…
新增問題並參考