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

@ -26,6 +26,7 @@ from weboob.tools.value import ValueBackendPassword, Value
from .browser import LCLBrowser
from .enterprise.browser import LCLEnterpriseBrowser
from .browser import LCLProBrowser
__all__ = ['LCLBackend']
@ -42,6 +43,7 @@ class LCLBackend(BaseBackend, CapBank):
ValueBackendPassword('password', label='Code personnel'),
Value('website', label='Type de compte', default='par',
choices={'par': 'Particuliers',
'pro': 'Professionnels',
'ent': 'Entreprises'}))
BROWSER = LCLBrowser
@ -51,6 +53,10 @@ class LCLBackend(BaseBackend, CapBank):
self.BROWSER = LCLEnterpriseBrowser
return self.create_browser(self.config['login'].get(),
self.config['password'].get())
elif website == 'pro':
self.BROWSER = LCLProBrowser
return self.create_browser(self.config['login'].get(),
self.config['password'].get())
else:
self.BROWSER = LCLBrowser
return self.create_browser(self.config['login'].get(),

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")

View file

@ -119,6 +119,11 @@ class LoginPage(BasePage):
self.browser.form.set_all_readonly(False)
self.browser['identifiant'] = login.encode('utf-8')
self.browser['postClavierXor'] = base64.b64encode(self.myXOR(password,seed))
try:
self.browser['identifiantRouting'] = self.browser.IDENTIFIANT_ROUTING
except AttributeError:
pass
try:
self.browser.submit(nologin=True)
except BrowserUnavailable: