Commit 2398d2e9 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Romain Bignon

modules: fix AbstractBrowser use

The weboob arg should now be passed as a kwarg, this avoids passing
multiple times the weboob as positional argument in case of multiple
AbstractBrowser.
parent eb28e271
......@@ -151,13 +151,13 @@ class BanquePopulaire(LoginBrowser):
def __init__(self, website, *args, **kwargs):
self.BASEURL = 'https://%s' % website
self.token = None
self.weboob = kwargs.pop('weboob')
self.weboob = kwargs['weboob']
super(BanquePopulaire, self).__init__(*args, **kwargs)
dirname = self.responses_dirname
if dirname:
dirname += '/bourse'
self.linebourse = LinebourseBrowser(self.weboob, 'https://www.linebourse.fr', logger=self.logger, responses_dirname=dirname)
self.linebourse = LinebourseBrowser('https://www.linebourse.fr', logger=self.logger, responses_dirname=dirname, weboob=self.weboob)
self.investments = {}
......
......@@ -55,14 +55,13 @@ class BforbankBrowser(LoginBrowser):
'https://bourse.bforbank.com/netfinca-titres/servlet/com.netfinca.frontcr.account.*',
BoursePage)
def __init__(self, weboob, birthdate, username, password, *args, **kwargs):
def __init__(self, birthdate, username, password, *args, **kwargs):
super(BforbankBrowser, self).__init__(username, password, *args, **kwargs)
self.birthdate = birthdate
self.accounts = None
self.weboob = weboob
self.weboob = kwargs['weboob']
self.spirica = SpiricaBrowser(weboob,
'https://assurance-vie.bforbank.com:443/',
self.spirica = SpiricaBrowser('https://assurance-vie.bforbank.com:443/',
None, None, *args, **kwargs)
def deinit(self):
......
......@@ -43,10 +43,10 @@ class BforbankModule(Module, CapBank):
BROWSER = BforbankBrowser
def create_default_browser(self):
return self.create_browser(self.weboob,
self.config['birthdate'].get(),
return self.create_browser(self.config['birthdate'].get(),
self.config['login'].get(),
self.config['password'].get())
self.config['password'].get(),
weboob=self.weboob)
def get_account(self, _id):
return find_object(self.browser.iter_accounts(), id=_id, error=AccountNotFound)
......
......@@ -43,6 +43,6 @@ class BnppereModule(AbstractModule, CapBank):
PARENT = 's2e'
def create_default_browser(self):
return self.create_browser(self.weboob,
self.config['login'].get(),
self.config['password'].get())
return self.create_browser(self.config['login'].get(),
self.config['password'].get(),
weboob=self.weboob)
......@@ -136,7 +136,7 @@ class BPBrowser(LoginBrowser, StatesMixin):
dirname = self.responses_dirname
if dirname:
dirname += '/bourse'
self.linebourse = LinebourseBrowser(self.weboob, 'https://labanquepostale.offrebourse.com/', logger=self.logger, responses_dirname=dirname)
self.linebourse = LinebourseBrowser('https://labanquepostale.offrebourse.com/', logger=self.logger, responses_dirname=dirname, weboob=self.weboob)
def deinit(self):
super(BPBrowser, self).deinit()
......
......@@ -44,10 +44,11 @@ class BtpbanqueModule(Module, CapBank):
def create_default_browser(self):
self.BROWSER = CreditCooperatifPro
return self.create_browser(self.weboob, "https://www.btpnet.tm.fr",
return self.create_browser("https://www.btpnet.tm.fr",
self.config['login'].get(),
self.config['password'].get(),
strong_auth=self.config['auth_type'].get() == "strong")
strong_auth=self.config['auth_type'].get() == "strong",
weboob=self.weboob)
def iter_accounts(self):
return self.browser.get_accounts_list()
......
......@@ -43,10 +43,10 @@ class CaelsModule(Module, CapBank):
BROWSER = CAELSBrowser
def create_default_browser(self):
return self.create_browser(self.weboob,
"https://www.ca-els.com/",
return self.create_browser("https://www.ca-els.com/",
self.config['login'].get(),
self.config['password'].get())
self.config['password'].get(),
weboob=self.weboob)
def get_account(self, id):
return find_object(self.iter_accounts(), id=id, error=AccountNotFound)
......
......@@ -43,6 +43,6 @@ class CapeasiModule(AbstractModule, CapBank):
PARENT = 's2e'
def create_default_browser(self):
return self.create_browser(self.weboob,
self.config['login'].get(),
self.config['password'].get())
return self.create_browser(self.config['login'].get(),
self.config['password'].get(),
weboob=self.weboob)
......@@ -42,6 +42,6 @@ class CICModule(AbstractModule, CapBankTransferAddRecipient, CapContact):
PARENT = 'creditmutuel'
def create_default_browser(self):
browser = self.create_browser(self.weboob, self.config['login'].get(), self.config['password'].get())
browser = self.create_browser(self.config['login'].get(), self.config['password'].get(), weboob=self.weboob)
browser.new_accounts.urls.insert(0, "/mabanque/fr/banque/comptes-et-contrats.html")
return browser
......@@ -43,10 +43,10 @@ class CicesModule(Module, CapBank):
BROWSER = CmesBrowser
def create_default_browser(self):
return self.create_browser(self.weboob,
'https://www.cic-epargnesalariale.fr',
return self.create_browser('https://www.cic-epargnesalariale.fr',
self.config['login'].get(),
self.config['password'].get())
self.config['password'].get(),
weboob=self.weboob)
def get_account(self, _id):
return find_object(self.browser.iter_accounts(), id=_id, error=AccountNotFound)
......
......@@ -48,9 +48,10 @@ class CmbModule(Module, CapBank, CapContact):
def create_default_browser(self):
b = {'par': CmsoParBrowser, 'pro': CmsoProBrowser}
self.BROWSER = b[self.config['website'].get()]
return self.create_browser(self.weboob, "cmb.fr",
return self.create_browser("cmb.fr",
self.config['login'].get(),
self.config['password'].get())
self.config['password'].get(),
weboob=self.weboob)
def get_account(self, _id):
return find_object(self.browser.iter_accounts(), id=_id, error=AccountNotFound)
......
......@@ -48,9 +48,10 @@ class CmmcModule(Module, CapBank, CapContact):
def create_default_browser(self):
b = {'par': CmsoParBrowser, 'pro': CmsoProBrowser}
self.BROWSER = b[self.config['website'].get()]
return self.create_browser(self.weboob, "cmmc.fr",
return self.create_browser("cmmc.fr",
self.config['login'].get(),
self.config['password'].get())
self.config['password'].get(),
weboob=self.weboob)
def get_account(self, _id):
return find_object(self.browser.iter_accounts(), id=_id, error=AccountNotFound)
......
......@@ -44,7 +44,7 @@ class ErehsbcModule(AbstractModule, CapBank):
PARENT = 's2e'
def create_default_browser(self):
return self.create_browser(self.weboob,
self.config['login'].get(),
return self.create_browser(self.config['login'].get(),
self.config['password'].get(),
secret=self.config['secret'].get())
secret=self.config['secret'].get(),
weboob=self.weboob)
......@@ -43,6 +43,6 @@ class EsaliaModule(AbstractModule, CapBank):
PARENT = 's2e'
def create_default_browser(self):
return self.create_browser(self.weboob,
self.config['login'].get(),
self.config['password'].get())
return self.create_browser(self.config['login'].get(),
self.config['password'].get(),
weboob=self.weboob)
......@@ -45,7 +45,7 @@ class GenericNewspaperModule(Module):
BROWSER = GenericPageBrowser
def create_default_browser(self):
return self.create_browser(self.weboob, self.weboob)
return self.create_browser(weboob=self.weboob)
def get_thread(self, _id):
if isinstance(_id, Thread):
......
......@@ -34,6 +34,6 @@ class NewspaperInrocksBrowser(AbstractBrowser):
'/.*',
ArticlePage)
def __init__(self, weboob, *args, **kwargs):
self.weboob = weboob
super(self.__class__, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self.weboob = kwargs['weboob']
super(NewspaperInrocksBrowser, self).__init__(*args, **kwargs)
......@@ -33,6 +33,6 @@ class NewspaperFigaroBrowser(AbstractBrowser):
'http://\w+.lefigaro.fr/(.*)',
ArticlePage)
def __init__(self, weboob, *args, **kwargs):
self.weboob = weboob
super(self.__class__, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self.weboob = kwargs['weboob']
super(NewspaperFigaroBrowser, self).__init__(*args, **kwargs)
......@@ -29,6 +29,6 @@ class NewspaperLibeBrowser(AbstractBrowser):
article = URL('http://.*liberation.fr/.*', ArticlePage)
def __init__(self, weboob, *args, **kwargs):
self.weboob = weboob
super(self.__class__, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self.weboob = kwargs['weboob']
super(NewspaperLibeBrowser, self).__init__(*args, **kwargs)
......@@ -29,6 +29,6 @@ class Newspaper20minutesBrowser(AbstractBrowser):
article_page = URL('/.+/?.*', ArticlePage)
def __init__(self, weboob, *args, **kwargs):
self.weboob = weboob
super(self.__class__, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self.weboob = kwargs['weboob']
super(Newspaper20minutesBrowser, self).__init__(*args, **kwargs)
......@@ -43,11 +43,11 @@ class PradoepargneModule(Module, CapBank):
BROWSER = CmesBrowser
def create_default_browser(self):
return self.create_browser(self.weboob,
"https://www.gestion-epargne-salariale.fr",
return self.create_browser("https://www.gestion-epargne-salariale.fr",
self.config['login'].get(),
self.config['password'].get(),
"pradoepargne/")
"pradoepargne/",
weboob=self.weboob)
def get_account(self, _id):
return find_object(self.browser.iter_accounts(), id=_id, error=AccountNotFound)
......
......@@ -31,9 +31,9 @@ class NewspaperPresseuropBrowser(AbstractBrowser):
presseurop_page = URL("/.*", PresseuropPage)
def __init__(self, weboob, *args, **kwargs):
self.weboob = weboob
super(self.__class__, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self.weboob = kwargs['weboob']
super(NewspaperPresseuropBrowser, self).__init__(*args, **kwargs)
def get_daily_date(self, _id):
self.location(_id)
......
......@@ -30,6 +30,6 @@ class NewspaperTazBrowser(AbstractBrowser):
article_page = URL('/.*', ArticlePage)
def __init__(self, weboob, *args, **kwargs):
self.weboob = weboob
super(self.__class__, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self.weboob = kwargs['weboob']
super(NewspaperTazBrowser, self).__init__(*args, **kwargs)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment