Refactored
This commit is contained in:
+5
-3
@@ -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__':
|
||||
|
||||
Reference in New Issue
Block a user