This commit is contained in:
Vincent Paredes 2014-07-08 15:18:24 +02:00 committed by Romain Bignon
commit 439ed46f13
3 changed files with 60 additions and 2 deletions

View file

@ -19,6 +19,7 @@
from urlparse import urlsplit, parse_qsl
from mechanize import Cookie
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
@ -26,7 +27,7 @@ from .pages import SkipPage, LoginPage, AccountsPage, AccountHistoryPage, \
CBListPage, CBHistoryPage, ContractsPage
__all__ = ['LCLBrowser']
__all__ = ['LCLBrowser','LCLProBrowser']
# Browser
@ -76,7 +77,8 @@ 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')
self.location('%s://%s/outil/UWSP/Synthese'
% (self.PROTOCOL, self.DOMAIN))
return self.page.get_list()
@ -119,3 +121,48 @@ class LCLBrowser(BaseBrowser):
self.location(card_link)
for tr in self.page.get_operations():
yield tr
class LCLProBrowser(LCLBrowser):
PROTOCOL = 'https'
DOMAIN = 'professionnels.secure.lcl.fr'
CERTHASH = ['6ae7053ef30f7c7810673115b021a42713f518f3a87b2e73ef565c16ead79f81']
ENCODING = 'utf-8'
USER_AGENT = BaseBrowser.USER_AGENTS['wget']
PAGES = {
'https://professionnels.secure.lcl.fr/outil/UAUT?from=/outil/UWHO/Accueil/': LoginPage,
'https://professionnels.secure.lcl.fr/outil/UAUT\?from=.*': LoginPage,
'https://professionnels.secure.lcl.fr/outil/UAUT/Accueil/preRoutageLogin': LoginPage,
'https://professionnels.secure.lcl.fr//outil/UAUT/Contract/routing': LoginPage,
'https://professionnels.secure.lcl.fr/outil/UWER/Accueil/majicER': LoginPage,
'https://professionnels.secure.lcl.fr/outil/UWER/Enregistrement/forwardAcc': LoginPage,
'https://professionnels.secure.lcl.fr/outil/UAUT/Contrat/choixContrat.*': ContractsPage,
'https://professionnels.secure.lcl.fr/outil/UAUT/Contract/getContract.*': ContractsPage,
'https://professionnels.secure.lcl.fr/outil/UAUT/Contract/selectContracts.*': ContractsPage,
'https://professionnels.secure.lcl.fr/outil/UWSP/Synthese': AccountsPage,
'https://professionnels.secure.lcl.fr/outil/UWLM/ListeMouvements.*/accesListeMouvements.*': AccountHistoryPage,
'https://professionnels.secure.lcl.fr/outil/UWCB/UWCBEncours.*/listeCBCompte.*': CBListPage,
'https://professionnels.secure.lcl.fr/outil/UWCB/UWCBEncours.*/listeOperations.*': CBHistoryPage,
'https://professionnels.secure.lcl.fr/outil/UAUT/Contrat/selectionnerContrat.*': SkipPage,
'https://professionnels.secure.lcl.fr/index.html': SkipPage
}
#We need to add this on the login form
IDENTIFIANT_ROUTING = 'CLA'
def add_cookie(self, name, value):
c = Cookie(0, name, value,
None, False,
'.' + self.DOMAIN, True, True,
'/', False,
False,
None,
False,
None,
None,
{})
cookiejar = self._ua_handlers["_cookies"].cookiejar
cookiejar.set_cookie(c)
def __init__(self, *args, **kwargs):
BaseBrowser.__init__(self, *args, **kwargs)
self.add_cookie("lclgen","professionnels")