From e32e174d7cd621b613f33ce98f83a7e70cc5b29b Mon Sep 17 00:00:00 2001 From: athuler <22741115+athuler@users.noreply.github.com> Date: Tue, 10 Sep 2024 21:26:48 +0200 Subject: [PATCH] Fixed Getting Systems Bug Fixed #22 --- passiogo/__init__.py | 43 ++++++++++++++++++++++--------------------- setup.py | 2 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/passiogo/__init__.py b/passiogo/__init__.py index 39bdf71..e80855b 100644 --- a/passiogo/__init__.py +++ b/passiogo/__init__.py @@ -429,27 +429,28 @@ def getSystems( for parameter in system.keys(): if system[parameter] == '': system[parameter] = None - try: - allSystems.append(TransportationSystem( - id = int(system["id"]), - name = system["fullname"], - username = system["username"], - goAgencyName = system["goAgencyName"], - email = system["email"], - goTestMode = bool(int(system["goTestMode"])), - name2 = bool(int(system["name2"])), - homepage = system["homepage"], - logo = bool(int(system["logo"])), - goRoutePlannerEnabled = bool(int(system["goRoutePlannerEnabled"])), - goColor = system["goColor"], - goSupportEmail = system["goSupportEmail"], - goSharedCode = toIntInclNone(system["goSharedCode"]), - goAuthenticationType = bool(int(system["goAuthenticationType"])), - )) - except Exception as e: - print(e) - print(system) - return() + + # Check all keys exist + for key in ["goAgencyName", "email", "email", "goTestMode", "name2", "homepage", "logo", "goRoutePlannerEnabled", "goColor", "goSupportEmail", "goSharedCode", "goAuthenticationType"]: + if key not in system.keys(): + system[key] = None + + allSystems.append(TransportationSystem( + id = int(system["id"]), + name = system["fullname"], + username = system["username"], + goAgencyName = system["goAgencyName"], + email = system["email"], + goTestMode = bool(int(system["goTestMode"])), + name2 = bool(int(system["name2"])), + homepage = system["homepage"], + logo = bool(int(system["logo"])), + goRoutePlannerEnabled = bool(int(system["goRoutePlannerEnabled"])), + goColor = system["goColor"], + goSupportEmail = system["goSupportEmail"], + goSharedCode = toIntInclNone(system["goSharedCode"]), + goAuthenticationType = bool(int(system["goAuthenticationType"])), + )) return(allSystems) diff --git a/setup.py b/setup.py index 5d3df85..1dc95b3 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='PassioGo', - version="0.2.1", + version="0.2.2", description="An unofficial API for Passio Go", long_description=long_description, long_description_content_type='text/markdown',