From f893599117d9dab2a9a40d13601e77f10fd96613 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Tue, 15 Oct 2024 13:45:52 +0200 Subject: [PATCH] add timestamp to filename --- arielle.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arielle.py b/arielle.py index 1104c57..bc027ba 100644 --- a/arielle.py +++ b/arielle.py @@ -55,6 +55,8 @@ def main(): record_list = [] _date_last = {} + initial_timestamp = create_timestamp().replace(':', '-').replace('.', '-') + # Collecting loop while True: start = time.time() @@ -68,7 +70,7 @@ def main(): data = w.get(endpoint) record_list.append({'info': {'record_id': record_id, 'timestamp': timestamp}, 'data': data}) folder = f_mgr.update(f"results/{vin}", _date) - filename = f"vehicle_{vin}.json" + filename = f"vehicle_{vin}_{initial_timestamp}.json" _path = os.path.join(folder, filename) with open(_path, "w") as fp: json.dump(record_list, fp, indent=4)