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.browser import BaseBrowser, BrowserIncorrectPassword
from weboob.tools.date import LinearDateGuesser 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'] __all__ = ['Cragr']
@ -41,6 +41,7 @@ class Cragr(BaseBrowser):
'https?://[^/]+/stb/.*act=Releves.*': TransactionsPage, 'https?://[^/]+/stb/.*act=Releves.*': TransactionsPage,
'https?://[^/]+/stb/collecteNI\?.*sessionAPP=Releves.*': TransactionsPage, 'https?://[^/]+/stb/collecteNI\?.*sessionAPP=Releves.*': TransactionsPage,
'https?://[^/]+/stb/.*/erreur/.*': LoginErrorPage, 'https?://[^/]+/stb/.*/erreur/.*': LoginErrorPage,
'https?://[^/]+/stb/entreeBam\?.*act=Messagesprioritaires': UselessPage,
} }
class WebsiteNotSupported(Exception): class WebsiteNotSupported(Exception):
@ -107,7 +108,7 @@ class Cragr(BaseBrowser):
self.location(url) self.location(url)
if self.is_on_page(LoginErrorPage) or not self.is_logged(): if self.is_on_page(LoginErrorPage):
raise BrowserIncorrectPassword() raise BrowserIncorrectPassword()
if not self.is_on_page(AccountsPage): 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 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): class HomePage(BasePage):
@ -62,6 +62,9 @@ class LoginPage(BasePage):
def get_result_url(self): def get_result_url(self):
return self.parser.tocleanstring(self.document.getroot()) return self.parser.tocleanstring(self.document.getroot())
class UselessPage(BasePage):
pass
class LoginErrorPage(BasePage): class LoginErrorPage(BasePage):
pass pass