do not raise BrowserIncorrectPassword when the website displays an useless "urgent message" on login

This commit is contained in:
Romain Bignon 2013-05-30 14:21:51 +02:00
commit 8cd0dff1df
2 changed files with 14 additions and 10 deletions

View file

@ -24,7 +24,7 @@ import re
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from weboob.tools.date import LinearDateGuesser
from .pages import HomePage, LoginPage, LoginErrorPage, AccountsPage, SavingsPage, TransactionsPage
from .pages import HomePage, LoginPage, LoginErrorPage, AccountsPage, SavingsPage, TransactionsPage, UselessPage
__all__ = ['Cragr']
@ -34,13 +34,14 @@ class Cragr(BaseBrowser):
PROTOCOL = 'https'
ENCODING = 'ISO-8859-1'
PAGES = {'https?://[^/]+/': HomePage,
'https?://[^/]+/stb/entreeBam': LoginPage,
'https?://[^/]+/stb/entreeBam\?.*act=Synthcomptes': AccountsPage,
'https?://[^/]+/stb/entreeBam\?.*act=Synthepargnes': SavingsPage,
'https?://[^/]+/stb/.*act=Releves.*': TransactionsPage,
'https?://[^/]+/stb/collecteNI\?.*sessionAPP=Releves.*': TransactionsPage,
'https?://[^/]+/stb/.*/erreur/.*': LoginErrorPage,
PAGES = {'https?://[^/]+/': HomePage,
'https?://[^/]+/stb/entreeBam': LoginPage,
'https?://[^/]+/stb/entreeBam\?.*act=Synthcomptes': AccountsPage,
'https?://[^/]+/stb/entreeBam\?.*act=Synthepargnes': SavingsPage,
'https?://[^/]+/stb/.*act=Releves.*': TransactionsPage,
'https?://[^/]+/stb/collecteNI\?.*sessionAPP=Releves.*': TransactionsPage,
'https?://[^/]+/stb/.*/erreur/.*': LoginErrorPage,
'https?://[^/]+/stb/entreeBam\?.*act=Messagesprioritaires': UselessPage,
}
class WebsiteNotSupported(Exception):
@ -107,7 +108,7 @@ class Cragr(BaseBrowser):
self.location(url)
if self.is_on_page(LoginErrorPage) or not self.is_logged():
if self.is_on_page(LoginErrorPage):
raise BrowserIncorrectPassword()
if not self.is_on_page(AccountsPage):

View file

@ -25,7 +25,7 @@ from weboob.tools.browser import BasePage
from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction
__all__ = ['HomePage', 'LoginPage', 'LoginErrorPage', 'AccountsPage', 'TransactionsPage']
__all__ = ['HomePage', 'LoginPage', 'LoginErrorPage', 'AccountsPage', 'TransactionsPage', 'UselessPage']
class HomePage(BasePage):
@ -62,6 +62,9 @@ class LoginPage(BasePage):
def get_result_url(self):
return self.parser.tocleanstring(self.document.getroot())
class UselessPage(BasePage):
pass
class LoginErrorPage(BasePage):
pass