Errors integrated

This commit is contained in:
Profitroll 2022-09-23 13:53:56 +02:00
parent 2851c5083f
commit a093d1b5d7
7 changed files with 42 additions and 14 deletions

View File

@ -2,6 +2,8 @@ from requests import get
from typing import List, Union from typing import List, Union
from xmltodict import parse as xmlparse from xmltodict import parse as xmlparse
from pyrmv.utility.find_exception import find_exception
try: try:
from typing import Literal from typing import Literal
except ImportError: except ImportError:
@ -26,6 +28,8 @@ def board_arrival(accessId: str,
output = get("https://www.rmv.de/hapi/arrivalBoard", params=payload, headers=headers) output = get("https://www.rmv.de/hapi/arrivalBoard", params=payload, headers=headers)
find_exception(output.json())
if json: if json:
return output.json() return output.json()
else: else:

View File

@ -2,6 +2,8 @@ from requests import get
from typing import List, Union from typing import List, Union
from xmltodict import parse as xmlparse from xmltodict import parse as xmlparse
from pyrmv.utility.find_exception import find_exception
try: try:
from typing import Literal from typing import Literal
except ImportError: except ImportError:
@ -26,6 +28,8 @@ def board_departure(accessId: str,
output = get("https://www.rmv.de/hapi/departureBoard", params=payload, headers=headers) output = get("https://www.rmv.de/hapi/departureBoard", params=payload, headers=headers)
find_exception(output.json())
if json: if json:
return output.json() return output.json()
else: else:

View File

@ -2,6 +2,8 @@ from requests import get
from typing import List, Union from typing import List, Union
from xmltodict import parse as xmlparse from xmltodict import parse as xmlparse
from pyrmv.utility.find_exception import find_exception
try: try:
from typing import Literal from typing import Literal
except ImportError: except ImportError:
@ -26,6 +28,8 @@ def journey_detail(accessId: str,
output = get("https://www.rmv.de/hapi/journeyDetail", params=payload, headers=headers) output = get("https://www.rmv.de/hapi/journeyDetail", params=payload, headers=headers)
find_exception(output.json())
if json: if json:
return output.json() return output.json()
else: else:

View File

@ -2,6 +2,8 @@ from requests import get
from typing import Union from typing import Union
from xmltodict import parse as xmlparse from xmltodict import parse as xmlparse
from pyrmv.utility.find_exception import find_exception
try: try:
from typing import Literal from typing import Literal
except ImportError: 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) output = get("https://www.rmv.de/hapi/location.nearbystops", params=payload, headers=headers)
find_exception(output.json())
if json: if json:
return output.json() return output.json()
else: else:

View File

@ -2,6 +2,8 @@ from requests import get
from typing import Union from typing import Union
from xmltodict import parse as xmlparse from xmltodict import parse as xmlparse
from pyrmv.utility.find_exception import find_exception
try: try:
from typing import Literal from typing import Literal
except ImportError: 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) output = get("https://www.rmv.de/hapi/location.name", params=payload, headers=headers)
find_exception(output.json())
if json: if json:
return output.json() return output.json()
else: else:

View File

@ -2,6 +2,8 @@ from requests import get
from typing import List, Union from typing import List, Union
from xmltodict import parse as xmlparse from xmltodict import parse as xmlparse
from pyrmv.utility.find_exception import find_exception
try: try:
from typing import Literal from typing import Literal
except ImportError: 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. * 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. * 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. * 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. * 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. 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. 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. 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. 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. * 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. * 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. 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. 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. 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. 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. * 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. * 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. 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. 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. 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. * 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. * 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. * 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) output = get("https://www.rmv.de/hapi/trip", params=payload, headers=headers)
find_exception(output.json())
if json: if json:
return output.json() return output.json()
else: else:

View File

@ -2,6 +2,8 @@ from requests import get
from typing import List, Union from typing import List, Union
from xmltodict import parse as xmlparse from xmltodict import parse as xmlparse
from pyrmv.utility.find_exception import find_exception
try: try:
from typing import Literal from typing import Literal
except ImportError: except ImportError:
@ -26,6 +28,8 @@ def trip_recon(accessId: str,
output = get("https://www.rmv.de/hapi/recon", params=payload, headers=headers) output = get("https://www.rmv.de/hapi/recon", params=payload, headers=headers)
find_exception(output.json())
if json: if json:
return output.json() return output.json()
else: else: