From: Sven Hoexter Date: Fri, 27 Aug 2021 11:30:19 +0000 (+0200) Subject: simplify exception to one try block X-Git-Url: https://git.sven.stormbind.net/?p=sven%2Fscripts.git;a=commitdiff_plain;h=79a5dcdef2ef3929f764413938f9067a74535415 simplify exception to one try block --- diff --git a/home/portalmonitor.py b/home/portalmonitor.py index 12a088e..2264206 100755 --- a/home/portalmonitor.py +++ b/home/portalmonitor.py @@ -46,10 +46,7 @@ def getCurrentPower(userName, password, stationId): 'pwd': password }, timeout=(10, 30)) - except requests.exceptions.RequestException as e: - raise SystemExit(e) - try: r = s.post( 'https://www.envertecportal.com/ApiStations/getStationInfo', data={ @@ -57,10 +54,7 @@ def getCurrentPower(userName, password, stationId): }, timeout=(10, 60)).json() power = r['Data']['Power'] - except requests.exceptions.RequestException as e: - raise SystemExit(e) - try: r = s.post('https://www.envertecportal.com/apiAccount/Logout', timeout=(10, 30)) except requests.exceptions.RequestException as e: