Project closed... the real API of the israeli railways closed...
A Python wrapper for the Israel Train API.
To install the package, run:
pip install git+https://github.com/Frostswing/Israel-Trains-Normal-API.git
To use the package, create an instance of the IsraelTrainAPI class and call its methods:
from israel_train_api import IsraelTrainAPI
api = IsraelTrainAPI()
station_names = api.get_station_names()
print(station_names)
routes = api.get_routes(source='תל אביב אוניברסיטה', destination='רעננה דרום')
print(routes)
next_departures = api.get_next_departures(source='תל אביב אוניברסיטה', destination='רעננה דרום')
print(next_departures)
routes = api.get_routes(source='תל אביב אוניברסיטה', destination='רעננה דרום', time='20:00', date='10/01/2022')
print(routes)
The main class for interacting with the API.
init(self) -> None Creates an instance of the IsraelTrainAPI class.
get_station_names(self) -> List[str] Gets a list of all station names.
get_routes(self, source: str, destination: str, time: Optional[str] = None, date: Optional[str] = None) -> List[Dict[str, Union[str, int]]] Gets all routes from a specific source to a specific destination.
Parameters
source (str): The name of the source station.
destination (str): The name of the destination station.
time (str, optional): The time of the desired departure (in the format HH:MM). If not provided, returns all routes.
date (str, optional): The date of the desired departure (in the format DD/MM/YYYY). If not provided, defaults to the current date.
Returns
A list of dictionaries, each representing a route. Each dictionary contains the following keys:
departure_time: The departure time (in the format HH:MM).
arrival_time: The arrival time (in the format HH:MM).
duration: The duration of the route (in the format HH:MM).
price: The price of the route.
train_type: The type of train (e.g. "רכבת ישירה