diff --git a/pyrmv/methods/stop_by_coords.py b/pyrmv/methods/stop_by_coords.py index 5dc6058..45731de 100644 --- a/pyrmv/methods/stop_by_coords.py +++ b/pyrmv/methods/stop_by_coords.py @@ -1,5 +1,8 @@ from typing import List, Union from pyrmv.classes.Stop import Stop +from pyrmv.enums.location_type import LocationType +from pyrmv.enums.lang import Language +from pyrmv.enums.selection_mode import SelectionMode from pyrmv.raw.stop_by_coords import stop_by_coords as raw_stop_by_coords try: @@ -13,11 +16,11 @@ def stop_by_coords( coords_lat: Union[str, float], coords_lon: Union[str, float], - lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en", + lang: Literal[Language.DE, Language.DA, Language.EN, Language.ES, Language.FR, Language.HU, Language.IT, Language.NL, Language.NO, Language.PL, Language.SV, Language.TR] = Language.EN, radius: Union[int, float] = 1000, max_number: int = 10, - stop_type: Literal["S", "P", "SP", "SE", "SPE"] = "S", - selection_mode: Literal["SLCT_N", "SLCT_A"] = None, # type: ignore + stop_type: Literal[LocationType.S, LocationType.P, LocationType.SP, LocationType.SE, LocationType.SPE] = LocationType.S, + selection_mode: Literal[SelectionMode.SLCT_A, SelectionMode.SLCT_N] = None, # type: ignore ) -> List[Stop]: """Method returns a list of stops around a given center coordinate. The returned results are ordered by their distance to the center coordinate. @@ -28,11 +31,11 @@ def stop_by_coords( * access_id (`str`): Access ID for identifying the requesting client. Get your key on [RMV website](https://opendata.rmv.de/site/start.html). * coords_lat (`Union[str, float]`): Latitude of centre coordinate. * coords_lon (`Union[str, float]`): Longitude of centre coordinate. - * lang (`Literal["de","da","en","es","fr","hu","it","nl","no","pl","sv","tr"]`, **optional**): The language of response. Defaults to "en". - * radius (`Union[int, float]`, **optional**): Search radius in meter around the given coordinate if any. Defaults to 1000. - * max_number (`int`, **optional**): Maximum number of returned stops. Defaults to 10. - * stop_type (`Literal["S", "P", "SP", "SE", "SPE"]`, **optional**): Type filter for location types. Defaults to "S". - * selection_mode (`Literal["SLCT_N", "SLCT_A"]`, **optional**): Selection mode for locations. Defaults to None. + * lang (`Literal[Language.DE, Language.DA, Language.EN, Language.ES, Language.FR, Language.HU, Language.IT, Language.NL, Language.NO, Language.PL, Language.SV, Language.TR]`, **optional**): The language of response. Defaults to `Language.EN`. + * radius (`Union[int, float]`, **optional**): Search radius in meter around the given coordinate if any. Defaults to `1000`. + * max_number (`int`, **optional**): Maximum number of returned stops. Defaults to `10`. + * stop_type (`Literal[LocationType.S, LocationType.P, LocationType.SP, LocationType.SE, LocationType.SPE]`, **optional**): Type filter for location types. Defaults to `LocationType.S`. + * selection_mode (`Literal[SelectionMode.SLCT_A, SelectionMode.SLCT_N]`, **optional**): Selection mode for locations. `SelectionMode.SLCT_N`: Not selectable, `SelectionMode.SLCT_A`: Selectable. Defaults to `None`. ### Returns: * dict: Output from RMV. Dict will contain "errorCode" and "errorText" if exception occurs. @@ -43,11 +46,11 @@ def stop_by_coords( accessId=access_id, originCoordLat=coords_lat, originCoordLong=coords_lon, - lang=lang, + lang=lang.code, radius=radius, maxNo=max_number, - stopType=stop_type, - locationSelectionMode=selection_mode + stopType=(stop_type.code).upper(), + locationSelectionMode=(selection_mode.code).upper() ) for stop in stops_raw["stopLocationOrCoordLocation"]: diff --git a/pyrmv/methods/stop_by_name.py b/pyrmv/methods/stop_by_name.py index 090fb32..01c3771 100644 --- a/pyrmv/methods/stop_by_name.py +++ b/pyrmv/methods/stop_by_name.py @@ -1,5 +1,9 @@ from typing import List, Union from pyrmv.classes.Stop import Stop +from pyrmv.enums.location_type import LocationType +from pyrmv.enums.lang import Language +from pyrmv.enums.selection_mode import SelectionMode +from pyrmv.enums.filter_mode import FilterMode from pyrmv.raw.stop_by_name import stop_by_name as raw_stop_by_name try: @@ -12,16 +16,16 @@ def stop_by_name( access_id: str, query: str, - lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en", + lang: Literal[Language.DE, Language.DA, Language.EN, Language.ES, Language.FR, Language.HU, Language.IT, Language.NL, Language.NO, Language.PL, Language.SV, Language.TR] = Language.EN, max_number: int = 10, - stop_type: Literal["A", "ALL", "AP", "P", "S", "SA", "SP"] = "ALL", - selection_mode: Literal["SLCT_N", "SLCT_A"] = None, # type: ignore + stop_type: Literal[LocationType.A, LocationType.ALL, LocationType.AP, LocationType.P, LocationType.S, LocationType.SA, LocationType.SP] = LocationType.ALL, + selection_mode: Literal[SelectionMode.SLCT_A, SelectionMode.SLCT_N] = None, # type: ignore coord_lat: Union[str, float] = None, # type: ignore coord_lon: Union[str, float] = None, # type: ignore radius: Union[int, float] = 1000, refine_id: str = None, # type: ignore stations: Union[str, list] = None, # type: ignore - filter_mode: Literal["DIST_PERI", "EXCL_PERI", "SLCT_PERI"] = "DIST_PERI" + filter_mode: Literal[FilterMode.DIST_PERI, FilterMode.EXCL_PERI, FilterMode.SLCT_PERI] = FilterMode.DIST_PERI ) -> List[Stop]: """Method can be used to perform a pattern matching of a user input and to retrieve a list of possible matches in the journey planner database. Possible matches might be stops/stations, @@ -30,18 +34,18 @@ def stop_by_name( More detailed request is available as raw.stop_by_name(), however returns dict instead of List[Stop]. ### Args: - * access_id (str): Access ID for identifying the requesting client. Get your key on [RMV website](https://opendata.rmv.de/site/start.html). - * query (str): Search for that token. - * lang (Literal["de","da","en","es","fr","hu","it","nl","no","pl","sv","tr"], optional): The language of response. Defaults to "en". - * max_number (int, optional): Maximum number of returned stops. In range 1-1000. Defaults to 10. - * stop_type (Literal["A", "ALL", "AP", "P", "S", "SA", "SP"], optional): Type filter for location types. Defaults to "ALL". - * selection_mode (str, optional): Selection mode for locations. "SLCT_N": Not selectable, "SLCT_A": Selectable. Defaults to None. - * coord_lat (Union[str, float], optional): Latitude of centre coordinate. Defaults to None. - * coord_lon (Union[str, float], optional): Longitude of centre coordinate. Defaults to None. - * radius (Union[int, float], optional): Search radius in meter around the given coordinate if any. Defaults to 1000. - * refine_id (str, optional): In case of an refinable location, this value takes the ID of the refinable one of a previous result. Defaults to None. - * stations (Union[str, list], optional): Filter for stations. Matches if the given value is prefix of any station in the itinerary. As a list or as a string separated by comma. Defaults to None. - * filter_mode (Literal["DIST_PERI", "EXCL_PERI", "SLCT_PERI"], optional): Filter modes for nearby searches. Defaults to "DIST_PERI". + * access_id (`str`): Access ID for identifying the requesting client. Get your key on [RMV website](https://opendata.rmv.de/site/start.html). + * query (`str`): Search for that token. + * lang (`Literal[Language.DE, Language.DA, Language.EN, Language.ES, Language.FR, Language.HU, Language.IT, Language.NL, Language.NO, Language.PL, Language.SV, Language.TR]`, **optional**): The language of response. Defaults to `Language.EN`. + * max_number (`int`, **optional**): Maximum number of returned stops. In range 1-1000. Defaults to `10`. + * stop_type (`Literal[LocationType.A, LocationType.ALL, LocationType.AP, LocationType.P, LocationType.S, LocationType.SA, LocationType.SP]`, **optional**): Type filter for location types. Defaults to `LocationType.ALL`. + * selection_mode (`Literal[SelectionMode.SLCT_A, SelectionMode.SLCT_N]`, **optional**): Selection mode for locations. `SelectionMode.SLCT_N`: Not selectable, `SelectionMode.SLCT_A`: Selectable. Defaults to `None`. + * coord_lat (`Union[str, float]`, **optional**): Latitude of centre coordinate. Defaults to `None`. + * coord_lon (`Union[str, float]`, **optional**): Longitude of centre coordinate. Defaults to `None`. + * radius (`Union[int, float]`, **optional**): Search radius in meter around the given coordinate if any. Defaults to `1000`. + * refine_id (`str`, **optional**): In case of an refinable location, this value takes the ID of the refinable one of a previous result. Defaults to `None`. + * stations (`Union[str, list]`, **optional**): Filter for stations. Matches if the given value is prefix of any station in the itinerary. As a list or as a string separated by comma. Defaults to `None`. + * filter_mode (`Literal[FilterMode.DIST_PERI, FilterMode.EXCL_PERI, FilterMode.SLCT_PERI]`, **optional**): Filter modes for nearby searches. Defaults to `FilterMode.DIST_PERI`. ### Returns: * dict: Output from RMV. Dict will contain "errorCode" and "errorText" if exception occurs. @@ -51,10 +55,10 @@ def stop_by_name( stops_raw = raw_stop_by_name( accessId=access_id, inputString=query, - lang=lang, + lang=lang.code, maxNo=max_number, - stopType=stop_type, - locationSelectionMode=selection_mode, + stopType=(stop_type.code).upper(), + locationSelectionMode=(selection_mode.code).upper(), coordLat=coord_lat, coordLong=coord_lon, radius=radius, diff --git a/pyrmv/methods/trip_find.py b/pyrmv/methods/trip_find.py index 8f63dc6..9ea758b 100644 --- a/pyrmv/methods/trip_find.py +++ b/pyrmv/methods/trip_find.py @@ -2,6 +2,8 @@ from datetime import datetime from typing import List, Union from pyrmv.classes.Trip import Trip from pyrmv.raw.trip_find import trip_find as raw_trip_find +from pyrmv.enums.rt_mode import RealTimeMode +from pyrmv.enums.lang import Language try: from typing import Literal @@ -11,7 +13,7 @@ except ImportError: def trip_find( access_id: str, - lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en", + lang: Literal[Language.DE, Language.DA, Language.EN, Language.ES, Language.FR, Language.HU, Language.IT, Language.NL, Language.NO, Language.PL, Language.SV, Language.TR] = Language.EN, origin_id: str = None, # type: ignore origin_id_ext: str = None, # type: ignore @@ -62,7 +64,7 @@ def trip_find( passing_points: bool = False, - real_time_mode: Literal["FULL", "INFOS", "OFF", "REALTIME", "SERVER_DEFAULT"] = None, # type: ignore + real_time_mode: Literal[RealTimeMode.FULL, RealTimeMode.INFOS, RealTimeMode.OFF, RealTimeMode.REALTIME, RealTimeMode.SERVER_DEFAULT] = None, # type: ignore include_earlier: bool = False, ict_alternatives: bool = False, @@ -78,48 +80,48 @@ def trip_find( ### Args: * access_id (`str`): Access ID for identifying the requesting client. Get your key on [RMV website](https://opendata.rmv.de/site/start.html). - * lang (`Literal["de","da","en","es","fr","hu","it","nl","no","pl","sv","tr"]`, **optional**): The language of response. Defaults to "en". - * origin_id (`str`, **optional**): Specifies the station/stop ID of the origin for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). Defaults to None. - * origin_id_ext (`str`, **optional**): Deprecated. Please use originId as it supports external IDs. Specifies the external station/stop ID of the origin for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). Defaults to None. - * origin_coord_lat (`Union[str, float]`, **optional**): Latitude of station/stop coordinate of the trip's origin. The coordinate can be retrieved from stop_by_name() or stop_by_coords(). Defaults to None. - * origin_coord_lon (`Union[str, float]`, **optional**): Longitude of station/stop coordinate of the trip's origin. The coordinate can be retrieved from stop_by_name() or stop_by_coords(). Defaults to None. - * origin_coord_name (`str`, **optional**): Name of the trip's origin if coordinate cannot be resolved to an address or poi. Defaults to None. - * destination_id (`str`, **optional**): Specifies the station/stop ID of the destination for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). Defaults to None. - * destination_id_ext (`str`, **optional**): Deprecated. Please use destId as it supports external IDs. Specifies the external station/stop ID of the destination for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). Defaults to None. - * destination_coord_lat (`Union[str, float]`, **optional**): Latitude of station/stop coordinate of the trip's destination. The coordinate can be retrieved from stop_by_name() or stop_by_coords(). Defaults to None. - * destination_coord_lon (`Union[str, float]`, **optional**): Longitude of station/stop coordinate of the trip's destination. The coordinate can be retrieved from stop_by_name() or stop_by_coords(). Defaults to None. - * destination_coord_name (`str`, **optional**): Name of the trip's destination if coordinate cannot be resolved to an address or poi. Defaults to None. - * via (`str`, **optional**): Complex structure to provide multiple via points separated by semicolon. This structure is build like this: `viaId|waittime|viastatus|products|direct|sleepingCar|couchetteCoach|attributes`. Read more about this in HAFAS ReST Documentation. Defaults to None. - * via_id (`str`, **optional**): ID of a station/stop used as a via for the trip. Specifying a via station forces the trip search to look for trips which must pass through this station. Such ID can be retrieved from stop_by_name() or stop_by_coords(). If `via` is used, `via_id` and `via_wait_time ` are having no effect. Defaults to None. - * via_gis (`str`, **optional**): Complex structure to provide multiple GIS via locations separated by semicolon. This structure is build like this: `locationId|locationMode|transportMode|placeType|usageType|mode|durationOfStay`. Read more about this in HAFAS ReST Documentation. Defaults to None. + * lang (`Literal[Language.DE, Language.DA, Language.EN, Language.ES, Language.FR, Language.HU, Language.IT, Language.NL, Language.NO, Language.PL, Language.SV, Language.TR]`, **optional**): The language of response. Defaults to `Language.EN`. + * origin_id (`str`, **optional**): Specifies the station/stop ID of the origin for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). Defaults to `None`. + * origin_id_ext (`str`, **optional**): Deprecated. Please use originId as it supports external IDs. Specifies the external station/stop ID of the origin for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). Defaults to `None`. + * origin_coord_lat (`Union[str, float]`, **optional**): Latitude of station/stop coordinate of the trip's origin. The coordinate can be retrieved from stop_by_name() or stop_by_coords(). Defaults to `None`. + * origin_coord_lon (`Union[str, float]`, **optional**): Longitude of station/stop coordinate of the trip's origin. The coordinate can be retrieved from stop_by_name() or stop_by_coords(). Defaults to `None`. + * origin_coord_name (`str`, **optional**): Name of the trip's origin if coordinate cannot be resolved to an address or poi. Defaults to `None`. + * destination_id (`str`, **optional**): Specifies the station/stop ID of the destination for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). Defaults to `None`. + * destination_id_ext (`str`, **optional**): Deprecated. Please use destId as it supports external IDs. Specifies the external station/stop ID of the destination for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). Defaults to `None`. + * destination_coord_lat (`Union[str, float]`, **optional**): Latitude of station/stop coordinate of the trip's destination. The coordinate can be retrieved from stop_by_name() or stop_by_coords(). Defaults to `None`. + * destination_coord_lon (`Union[str, float]`, **optional**): Longitude of station/stop coordinate of the trip's destination. The coordinate can be retrieved from stop_by_name() or stop_by_coords(). Defaults to `None`. + * destination_coord_name (`str`, **optional**): Name of the trip's destination if coordinate cannot be resolved to an address or poi. Defaults to `None`. + * via (`str`, **optional**): Complex structure to provide multiple via points separated by semicolon. This structure is build like this: `viaId|waittime|viastatus|products|direct|sleepingCar|couchetteCoach|attributes`. Read more about this in HAFAS ReST Documentation. Defaults to `None`. + * via_id (`str`, **optional**): ID of a station/stop used as a via for the trip. Specifying a via station forces the trip search to look for trips which must pass through this station. Such ID can be retrieved from stop_by_name() or stop_by_coords(). If `via` is used, `via_id` and `via_wait_time ` are having no effect. Defaults to `None`. + * via_gis (`str`, **optional**): Complex structure to provide multiple GIS via locations separated by semicolon. This structure is build like this: `locationId|locationMode|transportMode|placeType|usageType|mode|durationOfStay`. Read more about this in HAFAS ReST Documentation. Defaults to `None`. * via_wait_time (`int`, **optional**): Defines the waiting time spent at via station in minutes. If `via` is used, `via_id` and `via_wait_time` are having no effect. Defaults to 0. - * avoid (`str`, **optional**): Complex structure to provide multiple points to be avoided separated by semicolon. This structure is build like this: `avoidId|avoidstatus` avoidId: id, extId or altId of the avoid, mandatory avoidstatus: one of NPAVM (do not run through if this is a meta station), NPAVO (do not run through), NCAVM (do not change if this is a meta station), NCAVO (do not change), optional but defaults to NCAVM Example: Just define three avoids by extId: `avoid="801234;801235;801236"`. Defaults to None. - * avoid_id (`str`, **optional**): ID of a station/stop to be avoided as transfer stop for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). If `avoid` is used, `avoid_id` has no effect. Defaults to None. - * change_time_percent (`int`, **optional**): Configures the walking speed when changing from one leg of the journey to the next one. It extends the time required for changes by a specified percentage. A value of 200 doubles the change time as initially calculated by the system. In the response, change time is presented in full minutes. If the calculation based on changeTime-Percent does not result in a full minute, it is rounded using "round half up" method. Defaults to 100. - * change_time_min (`int`, **optional**): Minimum change time at stop in minutes. Defaults to None. - * change_time_max (`int`, **optional**): Maximum change time at stop in minutes. Defaults to None. - * change_time_add (`int`, **optional**): This amount of minutes is added to the change time at each stop. Defaults to None. - * change_max (`int`, **optional**): Maximum number of changes. In range 0-11. Defaults to None. - * date (`str`, **optional**): Sets the start date for which the departures shall be retrieved. Represented in the format `YYYY-MM-DD`. By default the current server date is used. Defaults to None. - * time (`str`, **optional**): Sets the start time for which the departures shall be retrieved. Represented in the format `hh:mm[:ss]` in 24h nomenclature. Seconds will be ignored for requests. By default the current server time is used. Defaults to None. - * search_arrival (`bool`, **optional**): If set, the date and time parameters specify the arrival time for the trip search instead of the departure time. Defaults to False. - * trips_after_time (`int`, **optional**): Minimum number of trips after the search time. Sum of `trips_after_time` and `trips_before_time` has to be less or equal 6. Read more about this in HAFAS ReST Documentation. In range 1-6. Defaults to None. - * trips_before_time (`int`, **optional**): Minimum number of trips before the search time. Sum of `trips_after_time` and `trips_before_time` has to be less or equal 6. Read more about this in HAFAS ReST Documentation. In range 0-6. Defaults to None. - * context (`str`, **optional**): Defines the starting point for the scroll back or forth operation. Use the scrB value from a previous result to scroll backwards in time and use the scrF value to scroll forth. Defaults to None. - * passlist (`bool`, **optional**): Enables/disables the return of the passlist for each leg of the trip. Defaults to False. - * operators (`Union[str, list]`, **optional**): Only trips provided by the given operators are part of the result. If the operator should not be part of the be trip, negate it by putting ! in front of it. Example: Filter for operator A and B: `operators=["A","B"]`. 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. - * iv_include (`bool`, **optional**): Enables/disables search for individual transport routes. Defaults to False. - * iv_only (`bool`, **optional**): Enables/disables search for individual transport routes only. Defaults to False. - * bike_carriage (`bool`, **optional**): Enables/disables search for trips explicit allowing bike carriage. This will only work in combination with `change_max=0` as those trips are always meant to be direct connections. Defaults to False. - * passing_points (`bool`, **optional**): Enables/disables the return of stops having no alighting and boarding in its passlist for each leg of the trip. Needs passlist enabled. Defaults to False. - * real_time_mode (`Literal["FULL", "INFOS", "OFF", "REALTIME", "SERVER_DEFAULT"]`, **optional**): Set the realtime mode to be used. Read more about this in HAFAS ReST Documentation. Defaults to None. - * include_earlier (`bool`, **optional**): Disables search optimization in relation of duration. Defaults to False. - * ict_alternatives (`bool`, **optional**): Enables/disables the search for alternatives with individualized change times (ICT). Defaults to False. - * tariff (`bool`, **optional**): Enables/disables the output of tariff data. The default is configurable via provisioning. Defaults to None. - * messages (`bool`, **optional**): Enables/disables the output of traffic messages. The default is configurable via provisioning. Defaults to False. - * frequency (`bool`, **optional**): Enables/disables the calculation of frequency information. Defaults to True. + * avoid (`str`, **optional**): Complex structure to provide multiple points to be avoided separated by semicolon. This structure is build like this: `avoidId|avoidstatus` avoidId: id, extId or altId of the avoid, mandatory avoidstatus: one of NPAVM (do not run through if this is a meta station), NPAVO (do not run through), NCAVM (do not change if this is a meta station), NCAVO (do not change), optional but defaults to NCAVM Example: Just define three avoids by extId: `avoid="801234;801235;801236"`. Defaults to `None`. + * avoid_id (`str`, **optional**): ID of a station/stop to be avoided as transfer stop for the trip. Such ID can be retrieved from stop_by_name() or stop_by_coords(). If `avoid` is used, `avoid_id` has no effect. Defaults to `None`. + * change_time_percent (`int`, **optional**): Configures the walking speed when changing from one leg of the journey to the next one. It extends the time required for changes by a specified percentage. A value of 200 doubles the change time as initially calculated by the system. In the response, change time is presented in full minutes. If the calculation based on changeTime-Percent does not result in a full minute, it is rounded using "round half up" method. Defaults to `100`. + * change_time_min (`int`, **optional**): Minimum change time at stop in minutes. Defaults to `None`. + * change_time_max (`int`, **optional**): Maximum change time at stop in minutes. Defaults to `None`. + * change_time_add (`int`, **optional**): This amount of minutes is added to the change time at each stop. Defaults to `None`. + * change_max (`int`, **optional**): Maximum number of changes. In range 0-11. Defaults to `None`. + * date (`str`, **optional**): Sets the start date for which the departures shall be retrieved. Represented in the format `YYYY-MM-DD`. By default the current server date is used. Defaults to `None`. + * time (`str`, **optional**): Sets the start time for which the departures shall be retrieved. Represented in the format `hh:mm[:ss]` in 24h nomenclature. Seconds will be ignored for requests. By default the current server time is used. Defaults to `None`. + * search_arrival (`bool`, **optional**): If set, the date and time parameters specify the arrival time for the trip search instead of the departure time. Defaults to `False`. + * trips_after_time (`int`, **optional**): Minimum number of trips after the search time. Sum of `trips_after_time` and `trips_before_time` has to be less or equal 6. Read more about this in HAFAS ReST Documentation. In range 1-6. Defaults to `None`. + * trips_before_time (`int`, **optional**): Minimum number of trips before the search time. Sum of `trips_after_time` and `trips_before_time` has to be less or equal 6. Read more about this in HAFAS ReST Documentation. In range 0-6. Defaults to `None`. + * context (`str`, **optional**): Defines the starting point for the scroll back or forth operation. Use the scrB value from a previous result to scroll backwards in time and use the scrF value to scroll forth. Defaults to `None`. + * passlist (`bool`, **optional**): Enables/disables the return of the passlist for each leg of the trip. Defaults to `False`. + * operators (`Union[str, list]`, **optional**): Only trips provided by the given operators are part of the result. If the operator should not be part of the be trip, negate it by putting ! in front of it. Example: Filter for operator A and B: `operators=["A","B"]`. 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`. + * iv_include (`bool`, **optional**): Enables/disables search for individual transport routes. Defaults to `False`. + * iv_only (`bool`, **optional**): Enables/disables search for individual transport routes only. Defaults to `False`. + * bike_carriage (`bool`, **optional**): Enables/disables search for trips explicit allowing bike carriage. This will only work in combination with `change_max=0` as those trips are always meant to be direct connections. Defaults to `False`. + * passing_points (`bool`, **optional**): Enables/disables the return of stops having no alighting and boarding in its passlist for each leg of the trip. Needs passlist enabled. Defaults to `False`. + * real_time_mode (`Literal[RealTimeMode.FULL, RealTimeMode.INFOS, RealTimeMode.OFF, RealTimeMode.REALTIME, RealTimeMode.SERVER_DEFAULT]`, **optional**): Set the realtime mode to be used. Read more about this in HAFAS ReST Documentation. Defaults to `None`. + * include_earlier (`bool`, **optional**): Disables search optimization in relation of duration. Defaults to `False`. + * ict_alternatives (`bool`, **optional**): Enables/disables the search for alternatives with individualized change times (ICT). Defaults to `False`. + * tariff (`bool`, **optional**): Enables/disables the output of tariff data. The default is configurable via provisioning. Defaults to `None`. + * messages (`bool`, **optional**): Enables/disables the output of traffic messages. The default is configurable via provisioning. Defaults to `False`. + * frequency (`bool`, **optional**): Enables/disables the calculation of frequency information. Defaults to `True`. ### Returns: * List[Trip]: List of Trip objects. Empty list if none found. @@ -129,7 +131,7 @@ def trip_find( trips_raw = raw_trip_find( accessId=access_id, - lang=lang, + lang=lang.code, originId=origin_id, originExtId=origin_id_ext, @@ -180,7 +182,7 @@ def trip_find( showPassingPoints=passing_points, - rtMode=real_time_mode, + rtMode=(real_time_mode.code).upper(), includeEarlier=include_earlier, withICTAlternatives=ict_alternatives,