support several contracts (only select default one for now)

This commit is contained in:
Romain Bignon 2012-10-19 16:33:01 +02:00
commit 853afb52b2
2 changed files with 14 additions and 2 deletions

View file

@ -23,7 +23,7 @@ from urlparse import urlsplit, parse_qsl
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from .pages import SkipPage, LoginPage, AccountsPage, AccountHistoryPage, \
CBListPage, CBHistoryPage
CBListPage, CBHistoryPage, ContractsPage
__all__ = ['LCLBrowser']
@ -39,6 +39,7 @@ class LCLBrowser(BaseBrowser):
PAGES = {
'https://particuliers.secure.lcl.fr/outil/UAUT/Authentication/authenticate': LoginPage,
'https://particuliers.secure.lcl.fr/outil/UAUT\?from=.*': LoginPage,
'https://particuliers.secure.lcl.fr/outil/UAUT/Contrat/choixContrat.*': ContractsPage,
'https://particuliers.secure.lcl.fr/outil/UWSP/Synthese': AccountsPage,
'https://particuliers.secure.lcl.fr/outil/UWLM/ListeMouvements.*/accesListeMouvements.*': AccountHistoryPage,
'https://particuliers.secure.lcl.fr/outil/UWCB/UWCBEncours.*/listeCBCompte.*': CBListPage,
@ -77,6 +78,7 @@ class LCLBrowser(BaseBrowser):
def get_accounts_list(self):
if not self.is_on_page(AccountsPage):
self.location('https://particuliers.secure.lcl.fr/outil/UWSP/Synthese')
return self.page.get_list()
def get_account(self, id):

View file

@ -32,7 +32,7 @@ from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard, VirtKeyboardEr
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
__all__ = ['SkipPage', 'LoginPage', 'AccountsPage', 'AccountHistoryPage']
__all__ = ['SkipPage', 'LoginPage', 'AccountsPage', 'AccountHistoryPage', 'ContractsPage']
class LCLVirtKeyboard(MappedVirtKeyboard):
@ -130,6 +130,16 @@ class LoginPage(BasePage):
return False
class ContractsPage(BasePage):
def on_loaded(self):
self.select_contract()
def select_contract(self):
# XXX We select automatically the default contract in list. We should let user
# ask what contract he wants to see, or display accounts for all contracts.
self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'mainForm')
self.browser.submit()
class AccountsPage(BasePage):
def get_list(self):
l = []