diff --git a/pyrmv/raw/board_arrival.py b/pyrmv/raw/board_arrival.py index adbd43c..9ebe0d9 100644 --- a/pyrmv/raw/board_arrival.py +++ b/pyrmv/raw/board_arrival.py @@ -2,6 +2,8 @@ from requests import get from typing import List, Union from xmltodict import parse as xmlparse +from pyrmv.utility.find_exception import find_exception + try: from typing import Literal except ImportError: @@ -26,6 +28,8 @@ def board_arrival(accessId: str, output = get("https://www.rmv.de/hapi/arrivalBoard", params=payload, headers=headers) + find_exception(output.json()) + if json: return output.json() else: diff --git a/pyrmv/raw/board_departure.py b/pyrmv/raw/board_departure.py index 499025b..4e486d3 100644 --- a/pyrmv/raw/board_departure.py +++ b/pyrmv/raw/board_departure.py @@ -2,6 +2,8 @@ from requests import get from typing import List, Union from xmltodict import parse as xmlparse +from pyrmv.utility.find_exception import find_exception + try: from typing import Literal except ImportError: @@ -26,6 +28,8 @@ def board_departure(accessId: str, output = get("https://www.rmv.de/hapi/departureBoard", params=payload, headers=headers) + find_exception(output.json()) + if json: return output.json() else: diff --git a/pyrmv/raw/journey_detail.py b/pyrmv/raw/journey_detail.py index c5417a4..5e8110e 100644 --- a/pyrmv/raw/journey_detail.py +++ b/pyrmv/raw/journey_detail.py @@ -2,6 +2,8 @@ from requests import get from typing import List, Union from xmltodict import parse as xmlparse +from pyrmv.utility.find_exception import find_exception + try: from typing import Literal except ImportError: @@ -26,6 +28,8 @@ def journey_detail(accessId: str, output = get("https://www.rmv.de/hapi/journeyDetail", params=payload, headers=headers) + find_exception(output.json()) + if json: return output.json() else: diff --git a/pyrmv/raw/stop_by_coords.py b/pyrmv/raw/stop_by_coords.py index 40f24d2..a4c9dd2 100644 --- a/pyrmv/raw/stop_by_coords.py +++ b/pyrmv/raw/stop_by_coords.py @@ -2,6 +2,8 @@ from requests import get from typing import Union from xmltodict import parse as xmlparse +from pyrmv.utility.find_exception import find_exception + try: from typing import Literal except ImportError: @@ -60,6 +62,8 @@ def stop_by_coords(accessId: str, output = get("https://www.rmv.de/hapi/location.nearbystops", params=payload, headers=headers) + find_exception(output.json()) + if json: return output.json() else: diff --git a/pyrmv/raw/stop_by_name.py b/pyrmv/raw/stop_by_name.py index 84f6bf1..c603d82 100644 --- a/pyrmv/raw/stop_by_name.py +++ b/pyrmv/raw/stop_by_name.py @@ -2,6 +2,8 @@ from requests import get from typing import Union from xmltodict import parse as xmlparse +from pyrmv.utility.find_exception import find_exception + try: from typing import Literal except ImportError: @@ -74,6 +76,8 @@ def stop_by_name(accessId: str, output = get("https://www.rmv.de/hapi/location.name", params=payload, headers=headers) + find_exception(output.json()) + if json: return output.json() else: diff --git a/pyrmv/raw/trip_find.py b/pyrmv/raw/trip_find.py index 8f5187c..e930218 100644 --- a/pyrmv/raw/trip_find.py +++ b/pyrmv/raw/trip_find.py @@ -2,6 +2,8 @@ from requests import get from typing import List, Union from xmltodict import parse as xmlparse +from pyrmv.utility.find_exception import find_exception + try: from typing import Literal except ImportError: @@ -169,22 +171,22 @@ def trip_find(accessId: str, * lines (Union[str, list], optional): Only journeys running the given line are part of the result. If the line should not be part of the be trip, negate it by putting ! in front of it. Defaults to None. * lineids (Union[str, list], optional): Only journeys running the given line (identified by its line ID) are part of the result. If the line should not be part of the be trip, negate it by putting ! in front of it. Defaults to None. * avoidPaths (List[Literal["SW", "EA", "ES", "RA", "CB"]], optional): Only path not having the given properties will be part of the result. "SW": Stairway; "EA": Elevator; "ES": Escalator; "RA": Ramp; "CB": Convey Belt. Example: Use paths without ramp and stairway: `avoidPaths="SW", "RA"`. Defaults to None. - * originWalk (Union[str, list], optional): Enables/disables using footpaths in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * originBike (Union[str, list], optional): Enables/disables using bike routes in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station or mode change point, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * originCar (Union[str, list], optional): Enables/disables using car in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * originTaxi (Union[str, list], optional): Enables/disables using taxi rides in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * originPark (Union[str, list], optional): Enables/disables using Park and Ride in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * originWalk (Union[str, list], optional): Enables/disables using footpaths in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * originBike (Union[str, list], optional): Enables/disables using bike routes in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station or mode change point, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * originCar (Union[str, list], optional): Enables/disables using car in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * originTaxi (Union[str, list], optional): Enables/disables using taxi rides in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * originPark (Union[str, list], optional): Enables/disables using Park and Ride in the beginning of a trip when searching from an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. * originMeta (Union[str, list], optional): Enables using one or more predefined individual transport meta profile at the beginning of a trip. Defaults to None. - * destWalk (Union[str, list], optional): Enables/disables using footpaths at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * destBike (Union[str, list], optional): Enables/disables using bike routes at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * destCar (Union[str, list], optional): Enables/disables using car routes at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * destTaxi (Union[str, list], optional): Enables/disables using taxi rides at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * destPark (Union[str, list], optional): Enables/disables using Park and Ride at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * destWalk (Union[str, list], optional): Enables/disables using footpaths at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * destBike (Union[str, list], optional): Enables/disables using bike routes at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * destCar (Union[str, list], optional): Enables/disables using car routes at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * destTaxi (Union[str, list], optional): Enables/disables using taxi rides at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * destPark (Union[str, list], optional): Enables/disables using Park and Ride at the end of a trip when searching to an address. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. * destMeta (Union[str, list], optional): Enables using one or more predefined individual transport meta profile at the end of a trip. Defaults to None. - * totalWalk (Union[str, list], optional): Enables/disables using footpaths for the whole trip. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * totalBike (Union[str, list], optional): Enables/disables using bike routes for the whole trip. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * totalCar (Union[str, list], optional): Enables/disables using car routes for the whole trip. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. - * totalTaxi (Union[str, list], optional): Enables/disables using taxi rides for the whole trip. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * totalWalk (Union[str, list], optional): Enables/disables using footpaths for the whole trip. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * totalBike (Union[str, list], optional): Enables/disables using bike routes for the whole trip. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * totalCar (Union[str, list], optional): Enables/disables using car routes for the whole trip. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. + * totalTaxi (Union[str, list], optional): Enables/disables using taxi rides for the whole trip. To fine-tune the minimum and/or maximum distance to the next public transport station, provide these values as a list or as a string separated by comma. These values are expressed in meters. Read more about this in HAFAS ReST Documentation. Defaults to None. * totalMeta (Union[str, list], optional): Enables using one or more predefined individual transport meta profile for a trip. Defaults to None. * gisProducts (str, optional): Filter on GIS product, e.g. specific sharing provider. Currently, only exclusion of certain providers is available by adding ! in front of the provider meta code. Defaults to None. * includeIv (bool, optional): Enables/disables search for individual transport routes. Defaults to False. @@ -232,6 +234,8 @@ def trip_find(accessId: str, output = get("https://www.rmv.de/hapi/trip", params=payload, headers=headers) + find_exception(output.json()) + if json: return output.json() else: diff --git a/pyrmv/raw/trip_recon.py b/pyrmv/raw/trip_recon.py index 0040f4c..02cf4b3 100644 --- a/pyrmv/raw/trip_recon.py +++ b/pyrmv/raw/trip_recon.py @@ -2,6 +2,8 @@ from requests import get from typing import List, Union from xmltodict import parse as xmlparse +from pyrmv.utility.find_exception import find_exception + try: from typing import Literal except ImportError: @@ -26,6 +28,8 @@ def trip_recon(accessId: str, output = get("https://www.rmv.de/hapi/recon", params=payload, headers=headers) + find_exception(output.json()) + if json: return output.json() else: