Skip to content

Commit 2d82eeb

Browse files
committed
Fix exception handling, add internet access interface
1 parent ae545b7 commit 2d82eeb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

onboardapis/train/de/db/apis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from ....units import ms
1515
from ... import Train, TrainStation
1616
from .mappings import id_name_map
17-
from .interfaces import ICEPortalAPI, RegioGuideAPI
17+
from .interfaces import ICEPortalAPI, RegioGuideAPI, ICEPortalInternetInterface
1818

1919
logger = logging.getLogger(__name__)
2020

@@ -25,9 +25,11 @@ class ICEPortal(Train, SpeedMixin, PositionMixin, StationsMixin[TrainStation], I
2525
"""Wrapper for interacting with the DB ICE Portal API."""
2626

2727
_api: ICEPortalAPI
28+
_internet_access: ICEPortalInternetInterface
2829

2930
def __init__(self):
3031
self._api = ICEPortalAPI()
32+
self._internet_access = ICEPortalInternetInterface(self._api)
3133
Train.__init__(self)
3234

3335
def now(self) -> datetime:
@@ -104,7 +106,7 @@ def current_station(self) -> TrainStation:
104106
# Get the station from the stations dict
105107
try:
106108
return self.stations_dict[station_id]
107-
except AttributeError as e:
109+
except KeyError as e:
108110
raise DataInvalidError("No current station found") from e
109111

110112
@property

0 commit comments

Comments
 (0)