WhereIsMyTrain
Remember:
- Replace placeholders like
your_irctc_user_idandyour_phone_numberwith actual values. - You'll need to have the
MultiFeaturespackage installed to run these examples. - These examples are asynchronous and need to be run within an
asyncfunction usingawait. - Install the package using
pip install -U MultiFeatures.
Usage
Methods
sync_train_schedule(last_synced: int = 0, dev_mode: bool = False, data_version: str = "7.2.4", network_type: str = "WIFI", lang: str = "en")
Syncs the train schedule with the server.
Parameters:
last_synced(int): The timestamp of the last sync. Defaults to 0.dev_mode(bool): Whether to use dev mode. Defaults to False.data_version(str): The version of the data. Defaults to "7.2.4".network_type(str): The type of network connection. Defaults to "WIFI".lang(str): The language for the response. Defaults to "en".
Returns:
dict: The JSON response containing the synced train schedule.
Example:
live_status(train_no: str, date: str, from_station: str, to_station: str, from_day: int = 1, lang: str = "en")
Gets the live status of a train.
Parameters:
train_no(str): The train number.date(str): The date of journey in the format 'dd-mm-yyyy'.from_station(str): The source station code.to_station(str): The destination station code.from_day(int): The day of journey. Defaults to 1.lang(str): The language for the response. Defaults to "en".
Returns:
dict: The JSON response containing live train status information.
Raises:
NotAValidTrainNumber: If the provided train number is not valid.
Example:
live_station(station_code: str, hrs: int = 8, lang: str = "en")
Gets the live status of trains at a particular station.
Parameters:
station_code(str): The station code.hrs(int): The number of hours to look ahead for train arrivals. Defaults to 8.lang(str): The language for the response. Defaults to "en".
Returns:
dict: The JSON response containing live station information.
Example: