fix retrieve of accounts

This commit is contained in:
Romain Bignon 2012-10-16 14:38:55 +02:00
commit bd001f631e
2 changed files with 16 additions and 5 deletions

View file

@ -31,11 +31,12 @@ __all__ = ['BanquePopulaire']
class BanquePopulaire(BaseBrowser):
PROTOCOL = 'https'
ENCODING = 'iso-8859-15'
PAGES = {'https://[^/]+/auth/UI/Login.*': LoginPage,
'https://[^/]+/cyber/internet/Login.do': IndexPage,
'https://[^/]+/cyber/internet/StartTask.do\?taskInfoOID=mesComptes.*': AccountsPage,
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=SOLDE.*': TransactionsPage,
'https://[^/]+/cyber/internet/Page.do\?.*taskInfoOID=mesComptes.*': TransactionsPage,
PAGES = {'https://[^/]+/auth/UI/Login.*': LoginPage,
'https://[^/]+/cyber/internet/Login.do': IndexPage,
'https://[^/]+/cyber/internet/StartTask.do\?taskInfoOID=mesComptes.*': AccountsPage,
'https://[^/]+/cyber/internet/StartTask.do\?taskInfoOID=maSyntheseGratuite.*': AccountsPage,
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=SOLDE.*': TransactionsPage,
'https://[^/]+/cyber/internet/Page.do\?.*taskInfoOID=mesComptes.*': TransactionsPage,
}
def __init__(self, website, *args, **kwargs):
@ -70,6 +71,9 @@ class BanquePopulaire(BaseBrowser):
def get_accounts_list(self):
self.location(self.buildurl('/cyber/internet/StartTask.do', taskInfoOID='mesComptes', token=self.token))
if self.page.is_error():
self.location(self.buildurl('/cyber/internet/StartTask.do', taskInfoOID='maSyntheseGratuite', token=self.token))
return self.page.get_list()
def get_account(self, id):

View file

@ -49,6 +49,13 @@ class AccountsPage(BasePage):
u'Mes comptes': Account.TYPE_CHECKING,
}
def is_error(self):
for script in self.document.xpath('//script'):
if script.text is not None and u"Le service est momentanément indisponible" in script.text:
return True
return False
def get_list(self):
account_type = Account.TYPE_UNKNOWN