[creditmutuel] backend corrected,
> i don't understand why Browser.__init__() is called many times so this > correction is a bit dirty but efficient
This commit is contained in:
parent
2eacb056c1
commit
d3e9195be5
1 changed files with 8 additions and 6 deletions
|
|
@ -22,10 +22,8 @@ from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
|
||||||
|
|
||||||
from .pages import LoginPage, LoginErrorPage, AccountsPage, OperationsPage, InfoPage
|
from .pages import LoginPage, LoginErrorPage, AccountsPage, OperationsPage, InfoPage
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['CreditMutuelBrowser']
|
__all__ = ['CreditMutuelBrowser']
|
||||||
|
|
||||||
|
|
||||||
# Browser
|
# Browser
|
||||||
class CreditMutuelBrowser(BaseBrowser):
|
class CreditMutuelBrowser(BaseBrowser):
|
||||||
PROTOCOL = 'https'
|
PROTOCOL = 'https'
|
||||||
|
|
@ -41,7 +39,8 @@ class CreditMutuelBrowser(BaseBrowser):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
BaseBrowser.__init__(self, *args, **kwargs)
|
BaseBrowser.__init__(self, *args, **kwargs)
|
||||||
self.SUB_BANKS = ['cmdv','cmcee','cmse', 'cmidf', 'cmsmb', 'cmma', 'cmmabn', 'cmc', 'cmlaco', 'cmnormandie', 'cmm']
|
#self.SUB_BANKS = ['cmdv','cmcee','cmse', 'cmidf', 'cmsmb', 'cmma', 'cmmabn', 'cmc', 'cmlaco', 'cmnormandie', 'cmm']
|
||||||
|
#self.currentSubBank = None
|
||||||
|
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
return self.page and not self.is_on_page(LoginPage)
|
return self.page and not self.is_on_page(LoginPage)
|
||||||
|
|
@ -62,9 +61,12 @@ class CreditMutuelBrowser(BaseBrowser):
|
||||||
if not self.is_logged() or self.is_on_page(LoginErrorPage):
|
if not self.is_logged() or self.is_on_page(LoginErrorPage):
|
||||||
raise BrowserIncorrectPassword()
|
raise BrowserIncorrectPassword()
|
||||||
|
|
||||||
|
self.SUB_BANKS = ['cmdv','cmcee','cmse', 'cmidf', 'cmsmb', 'cmma', 'cmmabn', 'cmc', 'cmlaco', 'cmnormandie', 'cmm']
|
||||||
|
self.getCurrentSubBank()
|
||||||
|
|
||||||
def get_accounts_list(self):
|
def get_accounts_list(self):
|
||||||
if not self.is_on_page(AccountsPage):
|
if not self.is_on_page(AccountsPage):
|
||||||
self.location('https://www.creditmutuel.fr/%s/fr/banque/situation_financiere.cgi'%self.getCurrentSubBank())
|
self.location('https://www.creditmutuel.fr/%s/fr/banque/situation_financiere.cgi'%self.currentSubBank)
|
||||||
return self.page.get_list()
|
return self.page.get_list()
|
||||||
|
|
||||||
def get_account(self, id):
|
def get_account(self, id):
|
||||||
|
|
@ -83,14 +85,14 @@ class CreditMutuelBrowser(BaseBrowser):
|
||||||
current_url_parts = current_url.split('/')
|
current_url_parts = current_url.split('/')
|
||||||
for subbank in self.SUB_BANKS:
|
for subbank in self.SUB_BANKS:
|
||||||
if subbank in current_url_parts:
|
if subbank in current_url_parts:
|
||||||
return subbank
|
self.currentSubBank = subbank
|
||||||
|
|
||||||
def get_history(self, account):
|
def get_history(self, account):
|
||||||
page_url = account.link_id
|
page_url = account.link_id
|
||||||
#operations_count = 0
|
#operations_count = 0
|
||||||
l_ret = []
|
l_ret = []
|
||||||
while (page_url):
|
while (page_url):
|
||||||
self.location('https://%s/%s/fr/banque/%s' % (self.DOMAIN, self.getCurrentSubBank(), page_url))
|
self.location('https://%s/%s/fr/banque/%s' % (self.DOMAIN, self.currentSubBank, page_url))
|
||||||
#for page_operation in self.page.get_history(operations_count):
|
#for page_operation in self.page.get_history(operations_count):
|
||||||
# operations_count += 1
|
# operations_count += 1
|
||||||
# yield page_operation
|
# yield page_operation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue