From 751a1490b1b8f20b913b58519ff8baacb5abba3c Mon Sep 17 00:00:00 2001 From: Sven Hoexter Date: Mon, 27 Mar 2023 21:00:15 +0200 Subject: [PATCH] Ignore timeouts on the envertech portal The relaunch of the portal made it so unreliable, that the most sensible thing to do right now is ignore connect timeouts. --- home/portalmonitor.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/home/portalmonitor.py b/home/portalmonitor.py index fdae4ba..c8b732b 100755 --- a/home/portalmonitor.py +++ b/home/portalmonitor.py @@ -45,19 +45,25 @@ def getCurrentPower(userName, password, stationId): 'userName': userName, 'pwd': password }, - timeout=(10, 30)) + timeout=(20, 40)) r = s.post( 'https://www.envertecportal.com/ApiStations/getStationInfo', data={ 'stationId': stationId }, - timeout=(10, 60)).json() + timeout=(20, 60)).json() power = r['Data']['Power'] r = s.post('https://www.envertecportal.com/apiAccount/Logout', - timeout=(10, 30)) + timeout=(20, 40)) + + # connect timeouts occur so frequently since the portal relaunch, + # ignore them for the time beeing completely + except requests.exceptions.ConnectTimeout as eTimeout: + sys.exit(1) except requests.exceptions.RequestException as e: + print(e) raise SystemExit(e) return float(power) -- 2.39.5