diff --git a/modules/themisbanque/browser.py b/modules/themisbanque/browser.py index 861990e2310d30e4b771f2c3a6280e5387dc4f88..5cdd29c15a2dfae5637497ed6133412c519fb95f 100644 --- a/modules/themisbanque/browser.py +++ b/modules/themisbanque/browser.py @@ -29,14 +29,14 @@ class ThemisBrowser(LoginBrowser): TIMEOUT = 90 - home = URL('/es@b/fr/esab.jsp') - login = URL('/es@b/fr/codeident.jsp', LoginPage) - login_confirm = URL('/es@b/servlet/internet0.ressourceWeb.servlet.Login', LoginConfirmPage) + home = URL(r'/es@b/fr/esab.jsp') + login = URL(r'/es@b/fr/codeident.jsp', LoginPage) + login_confirm = URL(r'/es@b/servlet/internet0.ressourceWeb.servlet.Login', LoginConfirmPage) accounts = URL(r'/es@b/servlet/internet0.ressourceWeb.servlet.PremierePageServlet\?pageToTreatError=fr/Infos.jsp&dummyDate=', r'/es@b/servlet/internet0.ressourceWeb.servlet.PremierePageServlet\?cryptpara=.*', r'/es@b/servlet/internet0.ressourceWeb.servlet.EsabServlet.*', AccountsPage) - history = URL('/es@b/servlet/internet0.ressourceWeb.servlet.ListeDesMouvementsServlet.*', HistoryPage) + history = URL(r'/es@b/servlet/internet0.ressourceWeb.servlet.ListeDesMouvementsServlet.*', HistoryPage) rib = URL(r'/es@b/fr/rib.jsp\?cryptpara=.*', RibPage) rib_pdf = URL(r'/es@b/servlet/internet0.ressourceWeb.servlet.RibPdfDownloadServlet', RibPDFPage) diff --git a/modules/themisbanque/module.py b/modules/themisbanque/module.py index d655eac19f5c453300041adc774f59e57fd5302f..33585d7f1f5f68b4200bf3b05d5ecf77d0e789df 100644 --- a/modules/themisbanque/module.py +++ b/modules/themisbanque/module.py @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this weboob module. If not, see . +from __future__ import unicode_literals from weboob.tools.backend import Module, BackendConfig from weboob.capabilities.bank import CapBank, AccountNotFound @@ -31,14 +32,15 @@ class ThemisModule(Module, CapBank, CapProfile): NAME = 'themisbanque' - DESCRIPTION = u'Themis' - MAINTAINER = u'Romain Bignon' + DESCRIPTION = 'Themis' + MAINTAINER = 'Romain Bignon' EMAIL = 'romain@weboob.org' LICENSE = 'LGPLv3+' VERSION = '1.6' - CONFIG = BackendConfig(ValueBackendPassword('login', label=u"Numéro d'abonné", masked=False), - ValueBackendPassword('password', label='Code secret'), - ) + CONFIG = BackendConfig( + ValueBackendPassword('login', label="Numéro d'abonné", masked=False), + ValueBackendPassword('password', label='Code secret'), + ) BROWSER = ThemisBrowser diff --git a/modules/themisbanque/pages.py b/modules/themisbanque/pages.py index 1e3cc78193bcf3bf6ec71d34cc84a33f35d84cfe..f3ad5170aff2c2833485036ae5961cac106f2d25 100644 --- a/modules/themisbanque/pages.py +++ b/modules/themisbanque/pages.py @@ -39,7 +39,7 @@ class MyCleanText(CleanText): @classmethod def clean(cls, txt, children=True, newlines=True, normalize='NFC'): if not isinstance(txt, basestring): - txt = u'\n'.join([t.strip() for t in txt.itertext()]) + txt = '\n'.join([t.strip() for t in txt.itertext()]) return txt @@ -135,14 +135,14 @@ def get_profile(self): # profile is inside a separated with a simple
without or
profile_txt = MyCleanText('//div[@class="TableauAffichage"]/table/tr[3]/td[1]')(self.doc).split('\n') i_name = 0 - profile.name = u'' + profile.name = '' # name can be on one, two, (more ?) lines, so we stop when line start by a number, we suppose it's the address number - while not re.search('^\d', profile_txt[i_name]): + while not re.search(r'^\d', profile_txt[i_name]): profile.name += ' ' + profile_txt[i_name] i_name += 1 profile.name = profile.name.strip() - profile.address = u'' + profile.address = '' # address is not always on two lines, so we consider every lines from here to before last are address, (last one is country) for i in range(i_name, len(profile_txt)-1): profile.address += ' ' + profile_txt[i] @@ -164,59 +164,58 @@ def get_iban(self): class Transaction(FrenchTransaction): - PATTERNS = [(re.compile(r'^VIR(EMENT)?( SEPA)? (?P.*)'), FrenchTransaction.TYPE_TRANSFER), - (re.compile(r'^PRLV (?P.*)'), FrenchTransaction.TYPE_ORDER), - (re.compile(r'^(?P.*) CARTE \d+ PAIEMENT CB\s+(?P
\d{2})(?P\d{2}) ?(.*)$'), - FrenchTransaction.TYPE_CARD), - (re.compile(r'^RETRAIT DAB (?P
\d{2})(?P\d{2}) (?P.*) CARTE [\*\d]+'), - FrenchTransaction.TYPE_WITHDRAWAL), - (re.compile(r'^CHEQUE( (?P.*))?$'), FrenchTransaction.TYPE_CHECK), - (re.compile(r'^(F )?COTIS\.? (?P.*)'), FrenchTransaction.TYPE_BANK), - (re.compile(r'^(REMISE|REM.CHQ) (?P.*)'), FrenchTransaction.TYPE_DEPOSIT), - (re.compile(r'^(?P.*)(?P
\d{2})(?P\d{2}) CARTE BLEUE'), FrenchTransaction.TYPE_CARD), - (re.compile(r'^PRVL SEPA (?P.*)'), FrenchTransaction.TYPE_ORDER), - (re.compile(r'^(?P(INT. DEBITEURS).*)'), FrenchTransaction.TYPE_BANK), - (re.compile(r'^(?P.*(VIR EMIS).*)'), FrenchTransaction.TYPE_TRANSFER), - (re.compile(r'^(?P.*(\bMOUVEMENT\b).*)'), FrenchTransaction.TYPE_TRANSFER), - (re.compile(r'^(?P.*(ARRETE TRIM.).*)'), FrenchTransaction.TYPE_BANK), - (re.compile(r'^(?P.*(TENUE DE DOSSIE).*)'), FrenchTransaction.TYPE_BANK), - (re.compile(r'^(?P.*(RELEVE LCR ECH).*)'), FrenchTransaction.TYPE_ORDER), - (re.compile(r'^(?P.*(\+ FORT DECOUVERT).*)'), FrenchTransaction.TYPE_BANK), - (re.compile(r'^(?P.*(EXTRANET @THEMI).*)'), FrenchTransaction.TYPE_BANK), - (re.compile(r'^(?P.*(REL CPT DEBITEU).*)'), FrenchTransaction.TYPE_ORDER), - (re.compile(r"^(?P.*(\bAFFRANCHISSEMENT\b).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(REMISE VIREMENTS MAGNE).*)"), FrenchTransaction.TYPE_TRANSFER), - (re.compile(r"^(?P.*(\bEFFET\b).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(\bMANIP\.\b).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(INTERETS SUR REMISE PTF).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(REMISE ESCOMPTE PTF).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(RETENUE DE GARANTIE).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(RESTITUTION RETENUE GARANTIE).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(\bAMENDES\b).*)"), FrenchTransaction.TYPE_TRANSFER), - (re.compile(r"^(?P.*(\bOA\b).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^.* COTIS ANN (?P.*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(FORFAIT CENT\.RE).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(ENVOI CB).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(RET\.SDD).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(RETOUR PVL ACD EXPERTISE).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(Annulation PAR REJ\/CHQ).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(REJET CHEQUE).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(CHQ PAYE INFRAC).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P^(CHQ IRREGULIER).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(ERREUR REMISE C).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P^(\bREMCHQ\b).*)"), FrenchTransaction.TYPE_DEPOSIT), - (re.compile(r"^(?P^(RETOUR PVL).*)"), FrenchTransaction.TYPE_TRANSFER), - (re.compile(r"^(?P.*(\bTRANSFERT\b).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(\bCONFIRMATION\b).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(CAUTION AVEC GAGE).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(\bRAPATRIEMENT\b).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r"^(?P.*(CHANGE REF).*)"), FrenchTransaction.TYPE_BANK), - (re.compile(r'^CARTE DU'), FrenchTransaction.TYPE_CARD), - (re.compile(r'^(VIR (SEPA)?|Vir|VIR.)(?P.*)'), FrenchTransaction.TYPE_TRANSFER), - (re.compile(r'^VIREMENT DE (?P.*)'), FrenchTransaction.TYPE_TRANSFER), - (re.compile(r'^(CHQ|CHEQUE) (?P.*)'), FrenchTransaction.TYPE_CHECK), - (re.compile(r'^(PRLV SEPA|PRELEVEMENT) (?P.*)'), FrenchTransaction.TYPE_ORDER), - ] + PATTERNS = [ + (re.compile(r'^VIR(EMENT)?( SEPA)? (?P.*)'), FrenchTransaction.TYPE_TRANSFER), + (re.compile(r'^PRLV (?P.*)'), FrenchTransaction.TYPE_ORDER), + (re.compile(r'^(?P.*) CARTE \d+ PAIEMENT CB\s+(?P
\d{2})(?P\d{2}) ?(.*)$'), FrenchTransaction.TYPE_CARD), + (re.compile(r'^RETRAIT DAB (?P
\d{2})(?P\d{2}) (?P.*) CARTE [\*\d]+'), FrenchTransaction.TYPE_WITHDRAWAL), + (re.compile(r'^CHEQUE( (?P.*))?$'), FrenchTransaction.TYPE_CHECK), + (re.compile(r'^(F )?COTIS\.? (?P.*)'), FrenchTransaction.TYPE_BANK), + (re.compile(r'^(REMISE|REM.CHQ) (?P.*)'), FrenchTransaction.TYPE_DEPOSIT), + (re.compile(r'^(?P.*)(?P
\d{2})(?P\d{2}) CARTE BLEUE'), FrenchTransaction.TYPE_CARD), + (re.compile(r'^PRVL SEPA (?P.*)'), FrenchTransaction.TYPE_ORDER), + (re.compile(r'^(?P(INT. DEBITEURS).*)'), FrenchTransaction.TYPE_BANK), + (re.compile(r'^(?P.*(VIR EMIS).*)'), FrenchTransaction.TYPE_TRANSFER), + (re.compile(r'^(?P.*(\bMOUVEMENT\b).*)'), FrenchTransaction.TYPE_TRANSFER), + (re.compile(r'^(?P.*(ARRETE TRIM.).*)'), FrenchTransaction.TYPE_BANK), + (re.compile(r'^(?P.*(TENUE DE DOSSIE).*)'), FrenchTransaction.TYPE_BANK), + (re.compile(r'^(?P.*(RELEVE LCR ECH).*)'), FrenchTransaction.TYPE_ORDER), + (re.compile(r'^(?P.*(\+ FORT DECOUVERT).*)'), FrenchTransaction.TYPE_BANK), + (re.compile(r'^(?P.*(EXTRANET @THEMI).*)'), FrenchTransaction.TYPE_BANK), + (re.compile(r'^(?P.*(REL CPT DEBITEU).*)'), FrenchTransaction.TYPE_ORDER), + (re.compile(r"^(?P.*(\bAFFRANCHISSEMENT\b).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(REMISE VIREMENTS MAGNE).*)"), FrenchTransaction.TYPE_TRANSFER), + (re.compile(r"^(?P.*(\bEFFET\b).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(\bMANIP\.\b).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(INTERETS SUR REMISE PTF).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(REMISE ESCOMPTE PTF).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(RETENUE DE GARANTIE).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(RESTITUTION RETENUE GARANTIE).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(\bAMENDES\b).*)"), FrenchTransaction.TYPE_TRANSFER), + (re.compile(r"^(?P.*(\bOA\b).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^.* COTIS ANN (?P.*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(FORFAIT CENT\.RE).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(ENVOI CB).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(RET\.SDD).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(RETOUR PVL ACD EXPERTISE).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(Annulation PAR REJ\/CHQ).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(REJET CHEQUE).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(CHQ PAYE INFRAC).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P^(CHQ IRREGULIER).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(ERREUR REMISE C).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P^(\bREMCHQ\b).*)"), FrenchTransaction.TYPE_DEPOSIT), + (re.compile(r"^(?P^(RETOUR PVL).*)"), FrenchTransaction.TYPE_TRANSFER), + (re.compile(r"^(?P.*(\bTRANSFERT\b).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(\bCONFIRMATION\b).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(CAUTION AVEC GAGE).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(\bRAPATRIEMENT\b).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r"^(?P.*(CHANGE REF).*)"), FrenchTransaction.TYPE_BANK), + (re.compile(r'^CARTE DU'), FrenchTransaction.TYPE_CARD), + (re.compile(r'^(VIR (SEPA)?|Vir|VIR.)(?P.*)'), FrenchTransaction.TYPE_TRANSFER), + (re.compile(r'^VIREMENT DE (?P.*)'), FrenchTransaction.TYPE_TRANSFER), + (re.compile(r'^(CHQ|CHEQUE) (?P.*)'), FrenchTransaction.TYPE_CHECK), + (re.compile(r'^(PRLV SEPA|PRELEVEMENT) (?P.*)'), FrenchTransaction.TYPE_ORDER), + ] class HistoryPage(LoggedPage, HTMLPage):