X-Git-Url: http://git.sven.stormbind.net/?p=sven%2Fscripts.git;a=blobdiff_plain;f=home%2Fportalmonitor.py;h=c8b732b46afb64181df4c0cc7cefed2e16747209;hp=fdae4ba21e67bd9c84458cf3a570cb7e00877d86;hb=HEAD;hpb=d68633c7d25e5c91a0dbce2d85ed98ad53c24781 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)