pax_global_header 0000666 0000000 0000000 00000000064 12356015330 0014510 g ustar 00root root 0000000 0000000 52 comment=e025fb0b2040e76d68512fca33d3483aa63d925d
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/ 0000775 0000000 0000000 00000000000 12356015330 0021576 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/ 0000775 0000000 0000000 00000000000 12356015330 0023246 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/ 0000775 0000000 0000000 00000000000 12356015330 0024020 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/__init__.py 0000664 0000000 0000000 00000001432 12356015330 0026131 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from .backend import LCLBackend
__all__ = ['LCLBackend']
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/backend.py 0000664 0000000 0000000 00000006342 12356015330 0025766 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2010-2013 Romain Bignon, Pierre Mazière
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword, Value
from .browser import LCLBrowser
from .enterprise.browser import LCLEnterpriseBrowser
__all__ = ['LCLBackend']
class LCLBackend(BaseBackend, CapBank):
NAME = 'lcl'
MAINTAINER = u'Romain Bignon'
EMAIL = 'romain@weboob.org'
VERSION = '0.j'
DESCRIPTION = u'LCL'
LICENSE = 'AGPLv3+'
CONFIG = BackendConfig(ValueBackendPassword('login', label='Identifiant', masked=False),
ValueBackendPassword('password', label='Code personnel'),
Value('website', label='Type de compte', default='par',
choices={'par': 'Particuliers',
'ent': 'Entreprises'}))
BROWSER = LCLBrowser
def create_default_browser(self):
website = self.config['website'].get()
if website == 'ent':
self.BROWSER = LCLEnterpriseBrowser
return self.create_browser(self.config['login'].get(),
self.config['password'].get())
else:
self.BROWSER = LCLBrowser
return self.create_browser(self.config['login'].get(),
self.config['password'].get())
def deinit(self):
# don't need to logout if the browser hasn't been used.
if not self._browser:
return
try:
deinit = self.browser.deinit
except AttributeError:
pass
else:
deinit()
def iter_accounts(self):
for account in self.browser.get_accounts_list():
yield account
def get_account(self, _id):
with self.browser:
account = self.browser.get_account(_id)
if account:
return account
else:
raise AccountNotFound()
def iter_coming(self, account):
if self.BROWSER != LCLBrowser:
raise NotImplementedError
with self.browser:
transactions = list(self.browser.get_cb_operations(account))
transactions.sort(key=lambda tr: tr.rdate, reverse=True)
return transactions
def iter_history(self, account):
with self.browser:
transactions = list(self.browser.get_history(account))
transactions.sort(key=lambda tr: tr.rdate, reverse=True)
return transactions
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/browser.py 0000664 0000000 0000000 00000011553 12356015330 0026062 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2010-2012 Romain Bignon, Pierre Mazière
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from urlparse import urlsplit, parse_qsl
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from .pages import SkipPage, LoginPage, AccountsPage, AccountHistoryPage, \
CBListPage, CBHistoryPage, ContractsPage
__all__ = ['LCLBrowser']
# Browser
class LCLBrowser(BaseBrowser):
PROTOCOL = 'https'
DOMAIN = 'particuliers.secure.lcl.fr'
CERTHASH = ['825a1cda9f3c7176af327013a20145ad587d1f7e2a7e226a1cb5c522e6e00b84']
ENCODING = 'utf-8'
USER_AGENT = BaseBrowser.USER_AGENTS['wget']
PAGES = {
'https://particuliers.secure.lcl.fr/outil/UAUT/Authentication/authenticate': LoginPage,
'https://particuliers.secure.lcl.fr/outil/UAUT\?from=.*': LoginPage,
'https://particuliers.secure.lcl.fr/outil/UAUT/Accueil/preRoutageLogin': LoginPage,
'https://particuliers.secure.lcl.fr//outil/UAUT/Contract/routing': LoginPage,
'https://particuliers.secure.lcl.fr/outil/UWER/Accueil/majicER': LoginPage,
'https://particuliers.secure.lcl.fr/outil/UWER/Enregistrement/forwardAcc': LoginPage,
'https://particuliers.secure.lcl.fr/outil/UAUT/Contrat/choixContrat.*': ContractsPage,
'https://particuliers.secure.lcl.fr/outil/UAUT/Contract/getContract.*': ContractsPage,
'https://particuliers.secure.lcl.fr/outil/UAUT/Contract/selectContracts.*': ContractsPage,
'https://particuliers.secure.lcl.fr/outil/UWSP/Synthese': AccountsPage,
'https://particuliers.secure.lcl.fr/outil/UWLM/ListeMouvements.*/accesListeMouvements.*': AccountHistoryPage,
'https://particuliers.secure.lcl.fr/outil/UWCB/UWCBEncours.*/listeCBCompte.*': CBListPage,
'https://particuliers.secure.lcl.fr/outil/UWCB/UWCBEncours.*/listeOperations.*': CBHistoryPage,
'https://particuliers.secure.lcl.fr/outil/UAUT/Contrat/selectionnerContrat.*': SkipPage,
'https://particuliers.secure.lcl.fr/index.html': SkipPage
}
def is_logged(self):
return not self.is_on_page(LoginPage)
def login(self):
assert isinstance(self.username, basestring)
assert isinstance(self.password, basestring)
assert self.password.isdigit()
if not self.is_on_page(LoginPage):
self.location('%s://%s/outil/UAUT/Authentication/authenticate'
% (self.PROTOCOL, self.DOMAIN),
no_login=True)
if not self.page.login(self.username, self.password) or \
(self.is_on_page(LoginPage) and self.page.is_error()) :
raise BrowserIncorrectPassword("invalid login/password.\nIf you did not change anything, be sure to check for password renewal request\non the original web site.\nAutomatic renewal will be implemented later.")
self.location('%s://%s/outil/UWSP/Synthese'
% (self.PROTOCOL, self.DOMAIN),
no_login=True)
def get_accounts_list(self):
if not self.is_on_page(AccountsPage):
self.location('https://particuliers.secure.lcl.fr/outil/UWSP/Synthese')
return self.page.get_list()
def get_account(self, id):
assert isinstance(id, basestring)
l = self.get_accounts_list()
for a in l:
if a.id == id:
return a
return None
def get_history(self, account):
self.location(account._link_id)
for tr in self.page.get_operations():
yield tr
for tr in self.get_cb_operations(account, 1):
yield tr
def get_cb_operations(self, account, month=0):
"""
Get CB operations.
* month=0 : current operations (non debited)
* month=1 : previous month operations (debited)
"""
for link in account._coming_links:
v = urlsplit(self.absurl(link))
args = dict(parse_qsl(v.query))
args['MOIS'] = month
self.location(self.buildurl(v.path, **args))
for tr in self.page.get_operations():
yield tr
for card_link in self.page.get_cards():
self.location(card_link)
for tr in self.page.get_operations():
yield tr
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/enterprise/ 0000775 0000000 0000000 00000000000 12356015330 0026200 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/enterprise/__init__.py 0000664 0000000 0000000 00000000000 12356015330 0030277 0 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/enterprise/browser.py 0000664 0000000 0000000 00000010653 12356015330 0030242 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2010-2013 Romain Bignon, Pierre Mazière, Noé Rubinstein
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from urllib import urlencode
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from .pages import HomePage, MessagesPage, LogoutPage, LogoutOkPage, \
AlreadyConnectedPage, ExpiredPage, MovementsPage, RootPage
__all__ = ['LCLEnterpriseBrowser']
class LCLEnterpriseBrowser(BaseBrowser):
PROTOCOL = 'https'
DOMAIN = 'entreprises.secure.lcl.fr'
CERTHASH = ['04e3509c20ac8bdbdb3d0ed37bc34db2dde5ed4bc4c30a3605f63403413099a9', '5fcf4a9ceeec25e406a04dffe0c6eacbdf72d11d394cd049701bfbaba3d853d9']
ENCODING = 'utf-8'
USER_AGENT = BaseBrowser.USER_AGENTS['wget']
PAGES_REV = {
LogoutPage: 'https://entreprises.secure.lcl.fr/outil/IQEN/Authentication/logout',
LogoutOkPage: 'https://entreprises.secure.lcl.fr/outil/IQEN/Authentication/logoutOk',
HomePage: 'https://entreprises.secure.lcl.fr/indexcle.html',
MessagesPage: 'https://entreprises.secure.lcl.fr/outil/IQEN/Bureau/mesMessages',
MovementsPage: 'https://entreprises.secure.lcl.fr/outil/IQMT/mvt.Synthese/syntheseMouvementPerso',
}
PAGES = {
PAGES_REV[HomePage]: HomePage,
PAGES_REV[LogoutPage]: LogoutPage,
PAGES_REV[LogoutOkPage]: LogoutOkPage,
PAGES_REV[MessagesPage]: MessagesPage,
PAGES_REV[MovementsPage]: MovementsPage,
'https://entreprises.secure.lcl.fr/outil/IQMT/mvt.Synthese/paginerReleve': MovementsPage,
'https://entreprises.secure.lcl.fr/': RootPage,
'https://entreprises.secure.lcl.fr/outil/IQEN/Authentication/dejaConnecte': AlreadyConnectedPage,
'https://entreprises.secure.lcl.fr/outil/IQEN/Authentication/sessionExpiree': ExpiredPage,
}
def __init__(self, *args, **kwargs):
BaseBrowser.__init__(self, *args, **kwargs)
self._logged = False
def deinit(self):
if self._logged:
self.logout()
def is_logged(self):
if self.page:
ID_XPATH = '//div[@id="headerIdentite"]'
self._logged = bool(self.page.document.xpath(ID_XPATH))
return self._logged
return False
def login(self):
assert isinstance(self.username, basestring)
assert isinstance(self.password, basestring)
if not self.is_on_page(HomePage):
self.location('/indexcle.html', no_login=True)
self.page.login(self.username, self.password)
if self.is_on_page(AlreadyConnectedPage):
raise BrowserIncorrectPassword("Another session is already open. Please try again later.")
if not self.is_logged():
raise BrowserIncorrectPassword(
"Invalid login/password.\n"
"If you did not change anything, be sure to check for password renewal request\n"
"on the original website.\n"
"Automatic renewal will be implemented later.")
def logout(self):
self.location(self.PAGES_REV[LogoutPage], no_login=True)
self.location(self.PAGES_REV[LogoutOkPage], no_login=True)
assert self.is_on_page(LogoutOkPage)
def get_accounts_list(self):
return [self.get_account()]
def get_account(self, id=None):
if not self.is_on_page(MovementsPage):
self.location(self.PAGES_REV[MovementsPage])
return self.page.get_account()
def get_history(self, account):
if not self.is_on_page(MovementsPage):
self.location(self.PAGES_REV[MovementsPage])
for n in range(1, self.page.nb_pages()):
self.location('/outil/IQMT/mvt.Synthese/paginerReleve',
urlencode({'numPage': str(n)}),
no_login=True)
for tr in self.page.get_operations():
yield tr
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/enterprise/pages.py 0000664 0000000 0000000 00000005324 12356015330 0027655 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2010-2013 Romain Bignon, Pierre Mazière, Noé Rubinstein
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from decimal import Decimal
from weboob.capabilities.bank import Account
from weboob.tools.browser import BasePage
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from ..pages import Transaction
class RootPage(BasePage):
pass
class LogoutPage(BasePage):
pass
class LogoutOkPage(BasePage):
pass
class MessagesPage(BasePage):
pass
class AlreadyConnectedPage(BasePage):
pass
class ExpiredPage(BasePage):
pass
class MovementsPage(BasePage):
def get_account(self):
LABEL_XPATH = '//*[@id="perimetreMandatEnfantLib"]'
BALANCE_XPATH = '//div[contains(text(),"Solde comptable :")]/strong'
account = Account()
account.id = 0
account.label = self.document.xpath(LABEL_XPATH)[0] \
.text_content().strip()
balance_txt = self.document.xpath(BALANCE_XPATH)[0] \
.text_content().strip()
account.balance = Decimal(FrenchTransaction.clean_amount(balance_txt))
account.currency = Account.get_currency(balance_txt)
return account
def nb_pages(self):
return int(self.document.xpath('//input[@name="nbPages"]/@value')[0])
def get_operations(self):
LINE_XPATH = '//table[@id="listeEffets"]/tbody/tr'
for line in self.document.xpath(LINE_XPATH):
_id = line.xpath('./@id')[0]
tds = line.xpath('./td')
[date, vdate, raw, debit, credit] = [td.text_content() for td in tds]
operation = Transaction(_id)
operation.parse(date=date, raw=raw)
operation.set_amount(credit, debit)
yield operation
class HomePage(BasePage):
def login(self, login, passwd):
p = lambda f: f.attrs.get('id') == "form_autoComplete"
self.browser.select_form(predicate=p)
self.browser["Ident_identifiant_"] = login.encode('utf-8')
self.browser["Ident_password_"] = passwd.encode('utf-8')
self.browser.submit(nologin=True)
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-lcl/modules/lcl/favicon.png 0000664 0000000 0000000 00000004541 12356015330 0026157 0 ustar 00root root 0000000 0000000 PNG
IHDR @ @ iq sRGB bKGD pHYs tIME
08u tEXtComment Created with GIMPW IDATx{pT眽&l$DB6$
HKLZ2ZPzbձNGءDڢlKk)X$ؐYe{.0,źKesyl}B#M$&