The Train status API I use recently added two additional key value pairs (has_arrived, has_departed) in the JSON object, which caused my script to crash.
It is possible to utilize Python's boolean value for int, str, list etc.
For example:
bool(1) # True
bool(0) # False
bool("a") # True
bool("") # False
bool([1]) # True
bool([]) # False
In Json file, you can set
"has_arrived": 0,
Then in your Python code
if data["has_arrived"]:
arrived()
else:
not_arrived()
The issue here is not to confuse 0 indicated for False and 0 for its value.