RedRail
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
pnr_status(pnr: str, mobile: str = "")
Gets the PNR status from the RedRail API.
Parameters:
pnr(str): The PNR number.mobile(str): The mobile number associated with the PNR (optional).
Returns:
dict: The JSON response containing PNR status information.
Example:
train_schedule(train_no: str)
Gets the schedule for a train from the RedRail API.
Parameters:
train_no(str): The train number.
Returns:
dict: The JSON response containing train schedule information.
Example:
coach_position(train_no: str, stn: str)
Gets the coach position for a train at a station from the RedRail API.
Parameters:
train_no(str): The train number.stn(str): The station code.
Returns:
dict: The JSON response containing coach position information.
Example:
search_routes(src: str, dst: str, doj: str)
Searches for routes between two stations on a given date from the RedRail API.
Parameters:
src(str): The source station code.dst(str): The destination station code.doj(str): The date of journey in the format 'yyyymmdd'.
Returns:
dict: The JSON response containing route search results.
Example:
user_status(irctc_username: str)
Gets the user status from the RedRail API.
Parameters:
irctc_username(str): The IRCTC username.
Returns:
dict: The JSON response containing user status information.
Example:
get_live_train_status(train_no: str)
Gets the live status of a train from the RedRail API.
Parameters:
train_no(str): The train number.
Returns:
dict: The JSON response containing live train status information.
Example: