Spaces:
Runtime error

File size: 668 Bytes
4b6ac23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)