verify file
This commit is contained in:
@@ -3,6 +3,15 @@ import json
|
||||
def main(args):
|
||||
route = args.get("route")
|
||||
|
||||
# Verify file exists, if not create it with default content
|
||||
try:
|
||||
with open("/app/state.json", "r") as f:
|
||||
pass
|
||||
except FileNotFoundError:
|
||||
with open("/app/state.json", "w") as f:
|
||||
json.dump({"text": ""}, f)
|
||||
f.flush()
|
||||
|
||||
body = args.get("body")
|
||||
body = json.loads(body) if body else {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user