From 0719eaacbcc108801c59eefbdfff9da72862e81b Mon Sep 17 00:00:00 2001 From: profitroll Date: Tue, 4 Oct 2022 14:40:27 +0200 Subject: [PATCH] Small enum fixes --- pyrmv/methods/stop_by_coords.py | 7 ++++++- pyrmv/methods/stop_by_name.py | 9 +++++++-- pyrmv/methods/trip_find.py | 7 ++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/pyrmv/methods/stop_by_coords.py b/pyrmv/methods/stop_by_coords.py index daba859..3837cc3 100644 --- a/pyrmv/methods/stop_by_coords.py +++ b/pyrmv/methods/stop_by_coords.py @@ -42,6 +42,11 @@ def stop_by_coords( * dict: Output from RMV. Dict will contain "errorCode" and "errorText" if exception occurs. """ + if selection_mode == None: + selection_mode = None + else: + selection_mode = (selection_mode.code).upper() + stops = [] stops_raw = raw_stop_by_coords( accessId=access_id, @@ -51,7 +56,7 @@ def stop_by_coords( radius=radius, maxNo=max_number, stopType=(stop_type.code).upper(), - locationSelectionMode=(selection_mode.code).upper() + locationSelectionMode=selection_mode ) find_exception(stops_raw) diff --git a/pyrmv/methods/stop_by_name.py b/pyrmv/methods/stop_by_name.py index 6faea8d..319eb4b 100644 --- a/pyrmv/methods/stop_by_name.py +++ b/pyrmv/methods/stop_by_name.py @@ -52,6 +52,11 @@ def stop_by_name( * dict: Output from RMV. Dict will contain "errorCode" and "errorText" if exception occurs. """ + if selection_mode == None: + selection_mode = None + else: + selection_mode = (selection_mode.code).upper() + stops = [] stops_raw = raw_stop_by_name( accessId=access_id, @@ -59,13 +64,13 @@ def stop_by_name( lang=lang.code, maxNo=max_number, stopType=(stop_type.code).upper(), - locationSelectionMode=(selection_mode.code).upper(), + locationSelectionMode=selection_mode, coordLat=coord_lat, coordLong=coord_lon, radius=radius, refineId=refine_id, stations=stations, - filterMode=filter_mode.code + filterMode=(filter_mode.code).upper() ) find_exception(stops_raw) diff --git a/pyrmv/methods/trip_find.py b/pyrmv/methods/trip_find.py index 0dabc6b..aebc514 100644 --- a/pyrmv/methods/trip_find.py +++ b/pyrmv/methods/trip_find.py @@ -128,6 +128,11 @@ def trip_find( * List[Trip]: List of Trip objects. Empty list if none found. """ + if real_time_mode == None: + real_time_mode = None + else: + real_time_mode = (real_time_mode.code).upper() + trips = [] trips_raw = raw_trip_find( @@ -183,7 +188,7 @@ def trip_find( showPassingPoints=passing_points, - rtMode=(real_time_mode.code).upper(), + rtMode=real_time_mode, includeEarlier=include_earlier, withICTAlternatives=ict_alternatives,