From 863bfcf9739de096a5ff765f92cb29509cd689f3 Mon Sep 17 00:00:00 2001 From: rex <64529246+RexVizsla@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:43:48 +0100 Subject: [PATCH] Update rmvtransport.py added time specification --- RMVtransport/rmvtransport.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RMVtransport/rmvtransport.py b/RMVtransport/rmvtransport.py index d28d7e8..fe545f6 100644 --- a/RMVtransport/rmvtransport.py +++ b/RMVtransport/rmvtransport.py @@ -55,9 +55,10 @@ async def get_departures( direction_id: Optional[str] = None, max_journeys: int = 20, products: Optional[List[str]] = None, + time: Optional[str] = "now" ) -> RMVtravel: """Fetch data from rmv.de.""" - url = self.build_journey_query(station_id, direction_id, max_journeys, products) + url = self.build_journey_query(station_id, direction_id, max_journeys, products, time) xml = await self._query_rmv_api(url) self.obj = extract_data_from_xml(xml) @@ -85,16 +86,18 @@ def build_journey_query( direction_id: Optional[str] = None, max_journeys: int = 20, products: Optional[List[str]] = None, + time: Optional[str] = "now" ) -> str: """Build query to request journey data.""" self.station_id = station_id self.direction_id = direction_id self.max_journeys = max_journeys self.products_filter = product_filter(products or ALL_PRODUCTS) + self.time = time params: Dict[str, Union[str, int]] = { "selectDate": "today", - "time": "now", + "time": self.time, "input": self.station_id, "maxJourneys": self.max_journeys, "boardType": "dep",