Commit f0ecd8fc authored by Jordan Augé's avatar Jordan Augé

[module/bp] fix: Unavailable RIB service prevents listing account balance

parent 3e29f496
Pipeline #3296 passed with stages
in 16 minutes and 28 seconds
......@@ -418,7 +418,10 @@ class AccountRIB(LoggedPage, RawPage):
iban_regexp = r'[A-Z]{2}\d{12}[0-9A-Z]{11}\d{2}'
def get_iban(self):
m = re.search(self.iban_regexp, extract_text(self.data))
text = extract_text(self.data)
if not text:
return None
m = re.search(self.iban_regexp, text)
if m:
return unicode(m.group(0))
return None
......
  • Example of unavailable service:

    weboob-rib-indispo

    Result in boobank

    boobank> list
                     Account                     Balance    Coming
    ------------------------------------------+----------+----------
    2020-07-18 00:12:31,395:DEBUG:bcall:2.0:bcall.py:92:backend_process <Backend 'bp'>: Calling function iter_resources
    [...]
    2020-07-18 00:12:32,700:DEBUG:backend.bp.browser:2.0:browsers.py:720:internal_callback Handle https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/comptesCommun/imprimerRIB/init-imprimer_rib.ea?numeroCompte=[REDACTED] with AccountRIB
    > [REDACTED]/.local/share/weboob/modules/2.0/bp/pages/accountlist.py(422)get_iban()
    -> m = re.search(self.iban_regexp, extract_text(self.data))
    (Pdb) p extract_text(self.data)
    None
    (Pdb) c
    2020-07-18 00:12:41,867:WARNING:backend.bp.browser.accountlist.item_account:2.0:elements.py:384:handle_attr Attribute iban (in [REDACTED]/.local/share/weboob/modules/2.0/bp/pages/accountlist.py:217) raises TypeError('expected string or bytes-like object')
    2020-07-18 00:12:41,868:DEBUG:bcall:2.0:bcall.py:98:backend_process <Backend 'bp'>: Called function iter_resources raised an error: TypeError('expected string or bytes-like object')
    Bug(bp): expected string or bytes-like object
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