[bp] Broken with house LOANs
Since 2019-06-11, Refresh account is broken when house LOANs exist in the Banque Postal customer account. This is my log from Kresus App.
https://voscomptesenligne.labanquepostale.fr:443 "GET /voscomptes/canalXHTML/pret/encours/../../sso/commun/init-integration.ea?partenaire=cristalCEC HTTP/1.1" 500 31957
2019-06-18 02:56:25,551:WARNING:item_account:elements.py:370:handle_attr Attribute iban (in /home/user/data/weboob-data/modules/1.6/bp/pages/accountlist.py:183) raises ServerError('500 Server Error: Internal Server Error',)
[2019-06-18T02:56:25.709] [INFO] sources/weboob - Command returned an error code.
[2019-06-18T02:56:25.727] [INFO] sources/weboob - Checking that weboob is installed and can actually be called…
[2019-06-18T02:56:25.728] [INFO] sources/weboob - Calling weboob: command test...
[2019-06-18T02:56:27.998] [INFO] sources/weboob - exited with code 0.
[2019-06-18T02:56:27.999] [INFO] sources/weboob - OK: weboob exited normally with non-empty JSON content.
[2019-06-18T02:56:28.000] [ERROR] sources/weboob - Got error while running command "accounts": Unknown error: 500 Server Error: Internal Server Error.
Traceback (most recent call last):
File "/usr/local/lib/node_modules/kresus/build/server/weboob/main.py", line 610, in fetch
results['values'] = self.get_accounts()
File "/usr/local/lib/node_modules/kresus/build/server/weboob/main.py", line 488, in get_accounts
for account in list(self.backend.iter_accounts()):
File "/home/user/data/weboob-data/modules/1.6/bp/module.py", line 63, in iter_accounts
return self.browser.get_accounts_list()
File "/weboob/weboob/browser/browsers.py", line 806, in inner
return func(browser, *args, **kwargs)
File "/home/user/data/weboob-data/modules/1.6/bp/browser.py", line 249, in get_accounts_list
for account in self.page.iter_accounts():
File "/weboob/weboob/browser/elements.py", line 203, in __iter__
for obj in item:
File "/weboob/weboob/browser/elements.py", line 346, in __iter__
self.handle_attr(attr, getattr(self, 'obj_%s' % attr))
File "/weboob/weboob/browser/elements.py", line 363, in handle_attr
value = self.use_selector(func, key=key)
File "/weboob/weboob/browser/elements.py", line 129, in use_selector
value = func()
File "/home/user/data/weboob-data/modules/1.6/bp/pages/accountlist.py", line 108, in obj_iban
details_page = self.page.browser.open(Field('url')(self)).page
File "/weboob/weboob/browser/browsers.py", line 720, in open
return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
File "/weboob/weboob/browser/browsers.py", line 612, in open
return super(DomainBrowser, self).open(req, *args, **kwargs)
File "/weboob/weboob/browser/browsers.py", line 364, in open
is_async=is_async)
File "/weboob/weboob/browser/sessions.py", line 160, in send
return func(*args, **kwargs)
File "/weboob/weboob/browser/sessions.py", line 153, in func
return callback(self, resp)
File "/weboob/weboob/browser/browsers.py", line 352, in inner_callback
self.raise_for_status(response)
File "/weboob/weboob/browser/browsers.py", line 392, in raise_for_status
raise cls(http_error_msg, response=response)
ServerError: 500 Server Error: Internal Server Error
I tried a fresh Kresus install with docker (weboob 1.5) or with Yunohost (weboob 1.5), and same error displays with a imported data or when i create a new Bank account.
I tried to understand, and it seems that break happens when weboob try to get Iban for House LOANs : In [bp] Banque Postale House LOAN doesn't have a iban.
Currently, i just find a "dirty" and quickly fix in bp module /pages/accountlist.py
if Field('type')(self) == Account.TYPE_LOAN:
return NotAvailable
in the def obj_iban(self) like this :
def obj_iban(self):
if not Field('url')(self):
return NotAvailable
if Field('type')(self) == Account.TYPE_LOAN:
return NotAvailable
details_page = self.page.browser.open(Field('url')(self)).page
rib_link = Link('//a[abbr[contains(text(), "RIB")]]', default=NotAvailable)(details_page.doc)
if rib_link:
response = self.page.browser.open(rib_link)
return response.page.get_iban()
elif Field('type')(self) == Account.TYPE_SAVINGS:
# The rib link is available on the history page (ex: Livret A)
his_page = self.page.browser.open(Field('url')(self))
rib_link = Link('//a[abbr[contains(text(), "RIB")]]', default=NotAvailable)(his_page.page.doc)
if rib_link:
response = self.page.browser.open(rib_link)
return response.page.get_iban()
return NotAvailable
Perharps [bp] mainteners can confirm or invalidate the problem. and make a better solution. I don't have the necessary distance about LOAN impacts.