Refactored

This commit is contained in:
2024-10-15 15:22:33 +02:00
parent 797e527f1a
commit 00843eda35
+5 -3
View File
@@ -61,12 +61,12 @@ def main():
while True:
start = time.time()
_date = get_date()
timestamp = create_timestamp()
if date_has_changed(_date_last, _date):
record_id = 0
record_list = []
try:
timestamp = create_timestamp()
data = w.get(endpoint)
record_list.append({'info': {'record_id': record_id, 'timestamp': timestamp}, 'data': data})
folder = f_mgr.update(f"results/{vin}", _date)
@@ -78,11 +78,13 @@ def main():
except Exception as e:
print(f"Exception: {e}")
_date_last = _date
record_id += 1
# wait until next loop
stop = time.time()
diff = int(stop - start)
time.sleep(max(0, INTERVAL - diff))
_date_last = _date
record_id += 1
if __name__ == '__main__':