]> git.sven.stormbind.net Git - sven/scripts.git/commitdiff
simplify exception to one try block
authorSven Hoexter <sven@stormbind.net>
Fri, 27 Aug 2021 11:30:19 +0000 (13:30 +0200)
committerSven Hoexter <sven@stormbind.net>
Fri, 27 Aug 2021 11:30:19 +0000 (13:30 +0200)
home/portalmonitor.py

index 12a088e1e6970c7baaca183993bb02a6af82c609..2264206090735e746dd2c0aabfb8fad028df3f2a 100755 (executable)
@@ -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: