if station ID is not found, try to look for it as a name and take the first result
It is possible to do both: traveloob> departures 2656@voyagessncf 2128@voyagessncf and: traveloob> departures paris lyon
This commit is contained in:
parent
33b9ae23be
commit
b319b92a15
1 changed files with 5 additions and 1 deletions
|
|
@ -104,7 +104,11 @@ class VoyagesSNCFBackend(BaseBackend, ICapTravel):
|
||||||
station = self.STATIONS[int(station_id)]
|
station = self.STATIONS[int(station_id)]
|
||||||
arrival = self.STATIONS[int(arrival_id)]
|
arrival = self.STATIONS[int(arrival_id)]
|
||||||
except (IndexError, ValueError):
|
except (IndexError, ValueError):
|
||||||
raise UserError('Unknown station')
|
try:
|
||||||
|
station = list(self.iter_station_search(station_id))[0].name
|
||||||
|
arrival = list(self.iter_station_search(arrival_id))[0].name
|
||||||
|
except IndexError:
|
||||||
|
raise UserError('Unknown station')
|
||||||
|
|
||||||
with self.browser:
|
with self.browser:
|
||||||
for i, d in enumerate(self.browser.iter_departures(station, arrival, date,
|
for i, d in enumerate(self.browser.iter_departures(station, arrival, date,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue