API Clients

Base Classes

We use mulitple inheritance to allow the implementation of clients supporting several types of requests.

class locomotive.api.client.BoardClient[source]
board_request(req: locomotive.api.requests.BoardRequest) → List[locomotive.models.board.BoardEntry][source]

Request the arrival or departure board for a train station.

class locomotive.api.client.TravelClient[source]
travel_request(req: locomotive.api.requests.TravelRequest) → List[locomotive.models.journey.Journey][source]

Request the available journeys and prices for a departure and arrival train station.

travel_request_full(req: locomotive.api.requests.TravelRequest) → List[locomotive.models.journey.Journey][source]

Batch fetch a full day.

travel_request_iter(req: locomotive.api.requests.TravelRequest) → Iterator[locomotive.models.journey.Journey][source]

Iteratively fetch a full day.

Requests

class locomotive.api.requests.BoardRequest(station: locomotive.models.station.Station, type_: str)[source]

Request the arrival or departure board for a train station.

station: Station = None
type_: str = None
class locomotive.api.requests.TravelRequest(departure_station: locomotive.models.station.Station, arrival_station: locomotive.models.station.Station, passengers: List[locomotive.models.passenger.Passenger], date: datetime.datetime, travel_class: str)[source]
arrival_station: Station = None
date: dt.datetime = None
departure_station: Station = None
passengers: List[Passenger] = None
travel_class: str = None

Implemented Clients

class locomotive.api.gc.Client(stations: locomotive.stores.Stations)[source]

Client for the www.garesetconnexions.sncf/fr/train-time API.

board_request(req: locomotive.api.requests.BoardRequest) → List[locomotive.models.board.BoardEntry][source]

Request the arrival or departure board for a train station.

class locomotive.api.oui_v3.Client(stations: locomotive.stores.Stations)[source]

Client for the wshoraires.oui.sncf V3 API

travel_request(req: locomotive.api.requests.TravelRequest) → List[locomotive.models.journey.Journey][source]

Request the available journeys and prices for a departure and arrival train station.