add timestamp to filename
This commit is contained in:
+3
-1
@@ -55,6 +55,8 @@ def main():
|
|||||||
record_list = []
|
record_list = []
|
||||||
_date_last = {}
|
_date_last = {}
|
||||||
|
|
||||||
|
initial_timestamp = create_timestamp().replace(':', '-').replace('.', '-')
|
||||||
|
|
||||||
# Collecting loop
|
# Collecting loop
|
||||||
while True:
|
while True:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
@@ -68,7 +70,7 @@ def main():
|
|||||||
data = w.get(endpoint)
|
data = w.get(endpoint)
|
||||||
record_list.append({'info': {'record_id': record_id, 'timestamp': timestamp}, 'data': data})
|
record_list.append({'info': {'record_id': record_id, 'timestamp': timestamp}, 'data': data})
|
||||||
folder = f_mgr.update(f"results/{vin}", _date)
|
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)
|
_path = os.path.join(folder, filename)
|
||||||
with open(_path, "w") as fp:
|
with open(_path, "w") as fp:
|
||||||
json.dump(record_list, fp, indent=4)
|
json.dump(record_list, fp, indent=4)
|
||||||
|
|||||||
Reference in New Issue
Block a user