support comfort classes
This commit is contained in:
parent
d8ccc81f93
commit
3186df0cc7
3 changed files with 10 additions and 5 deletions
|
|
@ -65,7 +65,10 @@ class VoyagesSNCFBackend(BaseBackend, ICapTravel):
|
|||
('MIFAM', u'Carte Famille Militaire'),
|
||||
('THBIZ', u'Thalys ThePass Business'),
|
||||
('THPREM', u'Thalys ThePass Premium'),
|
||||
('THWE', u'Thalys ThePass Weekend')))))
|
||||
('THWE', u'Thalys ThePass Weekend')))),
|
||||
Value('class', label='Comfort class', default='2',
|
||||
choices=OrderedDict((('1', u'1e classe'),
|
||||
('2', u'2e classe')))))
|
||||
|
||||
BROWSER = VoyagesSNCFBrowser
|
||||
STATIONS = []
|
||||
|
|
@ -106,7 +109,8 @@ class VoyagesSNCFBackend(BaseBackend, ICapTravel):
|
|||
with self.browser:
|
||||
for i, d in enumerate(self.browser.iter_departures(station, arrival, date,
|
||||
self.config['age'].get(),
|
||||
self.config['card'].get())):
|
||||
self.config['card'].get(),
|
||||
self.config['class'].get())):
|
||||
departure = Departure(i, d['type'], d['time'])
|
||||
departure.departure_station = d['departure']
|
||||
departure.arrival_station = d['arrival']
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ class VoyagesSNCFBrowser(BaseBrowser):
|
|||
self.location('/completion/VSC/FR/fr/cityList.js')
|
||||
return self.page.get_stations()
|
||||
|
||||
def iter_departures(self, departure, arrival, date, age, card):
|
||||
def iter_departures(self, departure, arrival, date, age, card, comfort_class):
|
||||
self.location('/billet-train')
|
||||
self.page.search(departure, arrival, date, age, card)
|
||||
self.page.search(departure, arrival, date, age, card, comfort_class)
|
||||
|
||||
return self.page.iter_results()
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class CitiesPage(BasePage):
|
|||
return result['CITIES']
|
||||
|
||||
class SearchPage(BasePage):
|
||||
def search(self, departure, arrival, date, age, card):
|
||||
def search(self, departure, arrival, date, age, card, comfort_class):
|
||||
self.browser.select_form(name='saisie')
|
||||
self.browser['ORIGIN_CITY'] = departure.encode(self.browser.ENCODING)
|
||||
self.browser['DESTINATION_CITY'] = arrival.encode(self.browser.ENCODING)
|
||||
|
|
@ -51,6 +51,7 @@ class SearchPage(BasePage):
|
|||
self.browser['OUTWARD_TIME'] = [str(date.hour)]
|
||||
self.browser['PASSENGER_1'] = [age]
|
||||
self.browser['PASSENGER_1_CARD'] = [card]
|
||||
self.browser['COMFORT_CLASS'] = [str(comfort_class)]
|
||||
self.browser.controls.append(ClientForm.TextControl('text', 'nbAnimalsForTravel', {'value': ''}))
|
||||
self.browser['nbAnimalsForTravel'] = '0'
|
||||
self.browser.submit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue