pax_global_header 0000666 0000000 0000000 00000000064 12356015330 0014510 g ustar 00root root 0000000 0000000 52 comment=e025fb0b2040e76d68512fca33d3483aa63d925d
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-creditdunord/ 0000775 0000000 0000000 00000000000 12356015330 0023512 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-creditdunord/modules/ 0000775 0000000 0000000 00000000000 12356015330 0025162 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-creditdunord/modules/creditdunord/ 0000775 0000000 0000000 00000000000 12356015330 0027650 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-creditdunord/modules/creditdunord/__init__.py 0000664 0000000 0000000 00000001447 12356015330 0031767 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2012 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 CreditDuNordBackend
__all__ = ['CreditDuNordBackend']
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-creditdunord/modules/creditdunord/backend.py 0000664 0000000 0000000 00000006345 12356015330 0031621 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2012-2013 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 weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import ValueBackendPassword, Value
from .browser import CreditDuNordBrowser
__all__ = ['CreditDuNordBackend']
class CreditDuNordBackend(BaseBackend, CapBank):
NAME = 'creditdunord'
MAINTAINER = u'Romain Bignon'
EMAIL = 'romain@weboob.org'
VERSION = '0.j'
DESCRIPTION = u'Crédit du Nord, Banque Courtois, Kolb, Tarneaud'
LICENSE = 'AGPLv3+'
website_choices = OrderedDict([(k, u'%s (%s)' % (v, k)) for k, v in sorted({
'www.credit-du-nord.fr': u'Crédit du Nord',
'www.banque-courtois.fr': u'Banque Courtois',
'www.banque-kolb.fr': u'Banque Kolb',
'www.banque-rhone-alpes.fr': u'Banque Rhône-Alpes',
'www.tarneaud.fr': u'Tarneaud',
}.iteritems(), key=lambda (k, v): (v, k))])
CONFIG = BackendConfig(Value('website', label='Banque', choices=website_choices, default='www.credit-du-nord.fr'),
ValueBackendPassword('login', label='Identifiant', masked=False),
ValueBackendPassword('password', label='Code confidentiel'))
BROWSER = CreditDuNordBrowser
def create_default_browser(self):
return self.create_browser(self.config['website'].get(),
self.config['login'].get(),
self.config['password'].get())
def iter_accounts(self):
with self.browser:
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_history(self, account):
with self.browser:
account = self.browser.get_account(account.id)
transactions = list(self.browser.get_history(account))
transactions.sort(key=lambda tr: tr.rdate, reverse=True)
return [tr for tr in transactions if not tr._is_coming]
def iter_coming(self, account):
with self.browser:
account = self.browser.get_account(account.id)
transactions = list(self.browser.get_card_operations(account))
transactions.sort(key=lambda tr: tr.rdate, reverse=True)
return [tr for tr in transactions if tr._is_coming]
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-creditdunord/modules/creditdunord/browser.py 0000664 0000000 0000000 00000010474 12356015330 0031713 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2012 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 .
import re
import urllib
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from .pages import LoginPage, AccountsPage, ProAccountsPage, TransactionsPage, ProTransactionsPage
__all__ = ['CreditDuNordBrowser']
class CreditDuNordBrowser(BaseBrowser):
PROTOCOL = 'https'
ENCODING = 'UTF-8'
PAGES = {'https://[^/]+/?': LoginPage,
'https://[^/]+/.*\?.*_pageLabel=page_erreur_connexion': LoginPage,
'https://[^/]+/vos-comptes/particuliers(\?.*)?': AccountsPage,
'https://[^/]+/vos-comptes/.*/transac/particuliers.*': TransactionsPage,
'https://[^/]+/vos-comptes/(?Pprofessionnels|entreprises).*': ProAccountsPage,
'https://[^/]+/vos-comptes/.*/transac/(professionnels|entreprises).*': ProTransactionsPage,
}
account_type = 'particuliers'
def __init__(self, website, *args, **kwargs):
self.DOMAIN = website
BaseBrowser.__init__(self, *args, **kwargs)
def is_logged(self):
return self.page is not None and not self.is_on_page(LoginPage)
def home(self):
if self.is_logged():
self.location(self.buildurl('/vos-comptes/%s' % self.account_type))
else:
self.login()
def login(self):
assert isinstance(self.username, basestring)
assert isinstance(self.password, basestring)
# not necessary (and very slow)
#self.location('https://www.credit-du-nord.fr/', no_login=True)
m = re.match('www.([^\.]+).fr', self.DOMAIN)
if not m:
bank_name = 'credit-du-nord'
self.logger.error('Unable to find bank name for %s' % self.DOMAIN)
else:
bank_name = m.group(1)
data = {'bank': bank_name,
'pagecible': 'vos-comptes',
'password': self.password.encode(self.ENCODING),
'pwAuth': 'Authentification+mot+de+passe',
'username': self.username.encode(self.ENCODING),
}
self.location(self.buildurl('/saga/authentification'), urllib.urlencode(data), no_login=True)
if not self.is_logged():
raise BrowserIncorrectPassword()
m = re.match('https://[^/]+/vos-comptes/(\w+).*', self.page.url)
if m:
self.account_type = m.group(1)
def get_accounts_list(self):
if not self.is_on_page(AccountsPage):
self.location(self.buildurl('/vos-comptes/%s' % self.account_type))
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 iter_transactions(self, link, args, is_coming=None):
if args is None:
return
while args is not None:
self.location(link, urllib.urlencode(args))
assert self.is_on_page(TransactionsPage)
self.page.is_coming = is_coming
for tr in self.page.get_history():
yield tr
is_coming = self.page.is_coming
args = self.page.get_next_args(args)
def get_history(self, account):
for tr in self.iter_transactions(account._link, account._args):
yield tr
for tr in self.get_card_operations(account):
yield tr
def get_card_operations(self, account):
for link_args in account._card_ids:
for tr in self.iter_transactions(account._link, link_args, True):
yield tr
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-creditdunord/modules/creditdunord/favicon.png 0000664 0000000 0000000 00000004067 12356015330 0032012 0 ustar 00root root 0000000 0000000 PNG
IHDR @ @ iq bKGD pHYs tIME
Gl IDATx}lU?Z[%:k*@s4qJdd73MX6ML/۲,efˌ!dd2Z]$p^ oc Cp}\z{{}iWins>o9ʶmf>Tyma7۳&K@>a.O5εY@y&(Q^mk.(Ks@kq vf(=`PB!PZe֯k9`pƀs?Ӕ "O/ZybH1f
I<e%f0,U`l*WĜYQ
oˁo͆2p\e Y z4P(UC)dk5Y x´T(dpFy&$] A5PY_[kY=r5@2W
>pA$Q~:H(6vFYt$Q MFbY_5$W ni;)xE`jE XHopj{vH0efJ?[WӁ`p?0KZ%Ksʇ&E亣>QNumd oˀ <1X4,I+GkI/[ H|dd2`[µ=:eƐfrZ.L%9YT6'+,Cq0;ƩC<.qIٶj(4EY$<gJ;-C?$OvѮ5 Dy$!!aB,S,C9?OQp7U÷L=b `v7; 8rh/+,C_\vo?>z.NA^M<"vұMeˤ_]
薡?