From 6809e3ae9c2804111eabfe3da56e105393dbeb18 Mon Sep 17 00:00:00 2001 From: profitroll Date: Wed, 5 Oct 2022 12:18:04 +0200 Subject: [PATCH] Fixed arguments --- pyrmv/methods/stop_by_coords.py | 4 ++-- pyrmv/methods/stop_by_name.py | 6 +++--- pyrmv/raw/stop_by_coords.py | 8 +++++++- pyrmv/raw/stop_by_name.py | 8 +++++++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pyrmv/methods/stop_by_coords.py b/pyrmv/methods/stop_by_coords.py index 3837cc3..ed0b6a0 100644 --- a/pyrmv/methods/stop_by_coords.py +++ b/pyrmv/methods/stop_by_coords.py @@ -45,7 +45,7 @@ def stop_by_coords( if selection_mode == None: selection_mode = None else: - selection_mode = (selection_mode.code).upper() + selection_mode = selection_mode.code stops = [] stops_raw = raw_stop_by_coords( @@ -55,7 +55,7 @@ def stop_by_coords( lang=lang.code, radius=radius, maxNo=max_number, - stopType=(stop_type.code).upper(), + stopType=stop_type.code, locationSelectionMode=selection_mode ) diff --git a/pyrmv/methods/stop_by_name.py b/pyrmv/methods/stop_by_name.py index 319eb4b..3276f68 100644 --- a/pyrmv/methods/stop_by_name.py +++ b/pyrmv/methods/stop_by_name.py @@ -55,7 +55,7 @@ def stop_by_name( if selection_mode == None: selection_mode = None else: - selection_mode = (selection_mode.code).upper() + selection_mode = selection_mode.code stops = [] stops_raw = raw_stop_by_name( @@ -63,14 +63,14 @@ def stop_by_name( inputString=query, lang=lang.code, maxNo=max_number, - stopType=(stop_type.code).upper(), + stopType=stop_type.code, locationSelectionMode=selection_mode, coordLat=coord_lat, coordLong=coord_lon, radius=radius, refineId=refine_id, stations=stations, - filterMode=(filter_mode.code).upper() + filterMode=filter_mode.code ) find_exception(stops_raw) diff --git a/pyrmv/raw/stop_by_coords.py b/pyrmv/raw/stop_by_coords.py index b3a250b..d98b3f5 100644 --- a/pyrmv/raw/stop_by_coords.py +++ b/pyrmv/raw/stop_by_coords.py @@ -54,7 +54,13 @@ def stop_by_coords(accessId: str, payload = {} for var, val in locals().items(): - if str(var) not in ["json", "headers", "payload", "raw_response"]: + if str(var) == "stopType": + if val != None: + payload["type"] = val.upper() + elif str(var) == "locationSelectionMode": + if val != None: + payload["locationSelectionMode"] = val.upper() + elif str(var) not in ["json", "headers", "payload", "raw_response"]: if val != None: payload[str(var)] = val diff --git a/pyrmv/raw/stop_by_name.py b/pyrmv/raw/stop_by_name.py index 1060d51..226beec 100644 --- a/pyrmv/raw/stop_by_name.py +++ b/pyrmv/raw/stop_by_name.py @@ -68,7 +68,13 @@ def stop_by_name(accessId: str, if str(var) == "inputString": if val != None: payload["input"] = val - elif str(var) not in ["json", "headers", "payload", "raw_response"]: + elif str(var) == "stopType": + if val != None: + payload["type"] = val.upper() + elif str(var) == "filterMode": + if val != None: + payload["filterMode"] = val.upper() + elif str(var) not in ["json", "headers", "payload", "raw_response", "stopType"]: if val != None: payload[str(var)] = val