ICapTravel.iter_station_departures can take an optional 'arival_station' argument
This commit is contained in:
parent
825aa80df6
commit
0f92967357
4 changed files with 13 additions and 8 deletions
|
|
@ -24,6 +24,10 @@ from weboob.capabilities.travel import ICapTravel, Station, Departure
|
|||
from .browser import CanalTP
|
||||
|
||||
class CanalTPBackend(Backend, ICapTravel):
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
EMAIL = 'romain@peerfuse.org'
|
||||
VERSION = '1.0'
|
||||
|
||||
def __init__(self, weboob):
|
||||
Backend.__init__(self, weboob)
|
||||
|
||||
|
|
@ -32,9 +36,9 @@ class CanalTPBackend(Backend, ICapTravel):
|
|||
for _id, name in canaltp.iter_station_search(pattern):
|
||||
yield Station(_id, name)
|
||||
|
||||
def iter_station_departures(self, station_id):
|
||||
def iter_station_departures(self, station_id, arrival_id=None):
|
||||
canaltp = CanalTP()
|
||||
for i, d in enumerate(canaltp.iter_station_departures(station_id)):
|
||||
for i, d in enumerate(canaltp.iter_station_departures(station_id, arrival_id)):
|
||||
departure = Departure(i, d['type'], d['time'])
|
||||
departure.departure_station = d['departure']
|
||||
departure.arrival_station = d['arrival']
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class CanalTP(Browser):
|
|||
else:
|
||||
yield _id, toUnicode(name)
|
||||
|
||||
def iter_station_departures(self, station_id):
|
||||
def iter_station_departures(self, station_id, arrival_id=None):
|
||||
result = self.openurl(u"http://widget.canaltp.fr/Prochains_departs_15122009/dev/index.php?gare=%s" % unicode(station_id)).read()
|
||||
result = result
|
||||
departure = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue