39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from datetime import datetime
|
|
from typing import Union
|
|
from pyrmv.classes.Journey import Journey
|
|
from pyrmv.errors.not_ready import NotReadyYetError
|
|
from pyrmv.enums.rt_mode import RealTimeMode
|
|
from pyrmv.raw.journey_detail import journey_detail as raw_journey_detail
|
|
from pyrmv.utility.find_exception import find_exception
|
|
|
|
try:
|
|
from typing import Literal
|
|
except ImportError:
|
|
from typing_extensions import Literal
|
|
|
|
def journey_detail(
|
|
|
|
access_id: str,
|
|
id: str,
|
|
date: Union[str, datetime] = None,
|
|
real_time_mode: Literal[RealTimeMode.FULL, RealTimeMode.INFOS, RealTimeMode.OFF, RealTimeMode.REALTIME, RealTimeMode.SERVER_DEFAULT] = None,
|
|
from_id: str = None,
|
|
from_index: int = None,
|
|
to_id: str = None,
|
|
to_index: int = None
|
|
):
|
|
|
|
journey_raw = raw_journey_detail(
|
|
accessId=access_id,
|
|
id=id,
|
|
date=date,
|
|
rtMode=real_time_mode.code,
|
|
fromId=from_id,
|
|
fromIdx=from_index,
|
|
toId=to_id,
|
|
toIdx=to_index
|
|
)
|
|
|
|
find_exception(journey_raw)
|
|
|
|
return Journey(journey_raw) |