From f98a896a391e9a8adf171b2b68961ba89a112287 Mon Sep 17 00:00:00 2001 From: Didi Hoffmann Date: Tue, 21 Nov 2023 19:58:27 +0100 Subject: [PATCH] v.04 --- power_logger.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/power_logger.py b/power_logger.py index 32a30ef..ed5ce04 100755 --- a/power_logger.py +++ b/power_logger.py @@ -28,7 +28,7 @@ from libs import caribou -VERSION = '0.3' +VERSION = '0.4' LOG_LEVELS = ['debug', 'info', 'warning', 'error', 'critical'] @@ -204,7 +204,7 @@ def upload_data_to_endpoint(local_stop_signal): logging.info(f"Uploading {len(payload)} rows to: {global_settings['api_url']}") try: - with urllib.request.urlopen(req) as response: + with urllib.request.urlopen(req, timeout=10) as response: if response.status == 204: for p in payload: tc.execute('UPDATE measurements SET uploaded = ?, data = NULL WHERE id = ?;', (int(time.time()), p['row_id']))