Spaces:
Runtime error

rtm-generator / rtm_memory.py
bobrod20's picture
Upload rtm_memory.py
4b6ac23 verified
Raw History Blame Contribute Delete
668 Bytes
import os
import json
def get_rtm_memory(workspace):
filename = f"rtms_{workspace}.json"
if os.path.exists(filename):
with open(filename, "r") as f:
return json.load(f)
return {}
def save_rtm_report(workspace, company, report):
filename = f"rtms_{workspace}.json"
data = get_rtm_memory(workspace)
data[company] = report
with open(filename, "w") as f:
json.dump(data, f)
def remove_rtm_report(workspace, company):
filename = f"rtms_{workspace}.json"
data = get_rtm_memory(workspace)
if company in data:
del data[company]
with open(filename, "w") as f:
json.dump(data, f)