[caissedepargne] part sociale account not properly detected when getting history
This is a template for submitting an issue, fill the blanks and remove non-applicable stuff.
First, read the frequently asked questions.
With which module do you encounter problems?
caissedepargne
Describe the problem you encounter
When accessing history of my PARTS SOCIALES
account woob crashes instead of ignoring the account
Paste here the stacktrace or error message you observe
Bug(caissedepargne): 400 Client Error: Bad Request
Traceback (most recent call last):
File "/tmp/woob/woob/core/bcall.py", line 88, in backend_process
result = function(backend, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/tools/application/base.py", line 348, in _do_complete
res = getattr(backend, function)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/modules/caissedepargne/module.py", line 84, in iter_history
return self.browser.iter_history(account)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/switch.py", line 98, in wrapper
return val(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/browsers.py", line 1157, in inner
return func(browser, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/modules/caissedepargne/browser.py", line 1252, in iter_history
self.go_to_secondary_space('linebourse', account)
File "/tmp/woob/modules/caissedepargne/browser.py", line 1171, in go_to_secondary_space
self.prepare_rerouting.go(json=data, website_id=account._website_id)
File "/tmp/woob/woob/browser/url.py", line 193, in go
r = self.browser.location(
^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/browsers.py", line 1071, in location
response = self.open(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/browsers.py", line 1058, in open
return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/browsers.py", line 915, in open
return super().open(url, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/browsers.py", line 566, in open
response = self.session.send(preq,
^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/sessions.py", line 161, in send
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/sessions.py", line 154, in func
return callback(self, resp)
^^^^^^^^^^^^^^^^^^^^
File "/tmp/woob/woob/browser/browsers.py", line 561, in inner_callback
self.raise_for_status(response)
File "/tmp/woob/woob/browser/browsers.py", line 626, in raise_for_status
raise ClientError(http_error_msg, response=response)
woob.browser.exceptions.ClientError: 400 Client Error: Bad Request
What are the steps to reproduce the problem?
Try to get the history of my PARTS SOCIALES
account.
What woob version are you using?
Output of woob config --version
command:
latest version on main branch
What module version are you using?
Output of woob config info MODULE_NAME
command:
.------------------------------------------------------------------------------.
| Module caissedepargne |
+-----------------.------------------------------------------------------------'
| Version | 202402071446
| Maintainer | Romain Bignon <romain@weboob.org>
| License | LGPLv3+
| Description | Caisse d'Épargne
| Capabilities | CapDocument, CapBankWealth, CapCredentialsCheck, CapCollection, CapBank
| Installed | yes
| Location | /tmp/woob/modules/caissedepargne
| |
| Configuration | login: Identifiant client (default: )
| | password: Mot de passe (default: )
| | nuser: User ID (optional) (default: )
| | auth_type: Type de compte (default: )
'-----------------'
How did you install woob?
Cloned the main branch from gitlab and used the ./tools/local_run.sh
script.
Additional info you'd like to mention
It looks like the test in browser.py to prevent fetching history of PARTS SOCIALES
account is not met in my case because my account label is PARTS SOCIALES
and not CPT PARTS SOCIALES
.
I fixed the issue locally by changing the condition to only check for PARTS SOCIALES
in the label instead of an exact match.
if account.type in (Account.TYPE_PEA, Account.TYPE_MARKET) and not account._is_cash_pea:
if 'PARTS SOCIALES' in account.label:
# TODO Investigate how to retrieve history
self.logger.warning('"CPT PARTS SOCIALES" account to investigate')
return []
self.go_to_secondary_space('linebourse', account)
history = self.linebourse.iter_history(account.id)
self.leave_linebo