new API in BaseBackend to create browser
This commit is contained in:
parent
2b93eec3c9
commit
c1279aa496
12 changed files with 84 additions and 87 deletions
|
|
@ -30,15 +30,14 @@ class CanalTPBackend(BaseBackend, ICapTravel):
|
|||
VERSION = '1.0'
|
||||
LICENSE = 'GPLv3'
|
||||
DESCRIPTION = "French trains"
|
||||
BROWSER = CanalTP
|
||||
|
||||
def iter_station_search(self, pattern):
|
||||
canaltp = CanalTP()
|
||||
for _id, name in canaltp.iter_station_search(pattern):
|
||||
for _id, name in self.browser.iter_station_search(pattern):
|
||||
yield Station(_id, name)
|
||||
|
||||
def iter_station_departures(self, station_id, arrival_id=None):
|
||||
canaltp = CanalTP()
|
||||
for i, d in enumerate(canaltp.iter_station_departures(station_id, arrival_id)):
|
||||
for i, d in enumerate(self.browser.iter_station_departures(station_id, arrival_id)):
|
||||
departure = Departure(i, d['type'], d['time'])
|
||||
departure.departure_station = d['departure']
|
||||
departure.arrival_station = d['arrival']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue