From 76445cc7fcdbd6f99c4804b48476c3618de02626 Mon Sep 17 00:00:00 2001 From: Damien Mat Date: Thu, 29 Aug 2019 18:08:21 +0200 Subject: [PATCH] [bnporc] Fixed old url used for HistoryPage Commit 246836bbf162dcd1fac9a56b844a058a771ff51f updated the url used for comings and history. For some connections the former url is still used. We don't knwow which ones do. It cannot be declared in the same URL object since it is used in a .go() method that might raise a BrowserUnavailable. Closes: 12950@zendesk, 25845@sibi --- modules/bnporc/pp/browser.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/bnporc/pp/browser.py b/modules/bnporc/pp/browser.py index 07bb8946e6..bd4b1957d8 100644 --- a/modules/bnporc/pp/browser.py +++ b/modules/bnporc/pp/browser.py @@ -37,7 +37,7 @@ from weboob.tools.json import json from weboob.browser.exceptions import ServerError from weboob.browser.elements import DataError -from weboob.exceptions import BrowserIncorrectPassword +from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable from weboob.tools.value import Value, ValueBool from weboob.tools.capabilities.bank.investments import create_french_liquidity @@ -100,6 +100,7 @@ class BNPParibasBrowser(JsonBrowserMixin, LoginBrowser): loan_details = URL(r'caraccomptes-wspl/rpc/(?P.*)', LoanDetailsPage) ibans = URL(r'rib-wspl/rpc/comptes', AccountsIBANPage) history = URL(r'rop2-wspl/rest/releveOp', HistoryPage) + history_old = URL(r'rop-wspl/rest/releveOp', HistoryPage) transfer_init = URL(r'virement-wspl/rest/initialisationVirement', TransferInitPage) lifeinsurances = URL(r'mefav-wspl/rest/infosContrat', LifeInsurancesPage) @@ -280,14 +281,21 @@ def iter_history(self, account, coming=False): if not self.card_to_transaction_type: self.list_detail_card.go() self.card_to_transaction_type = self.page.get_card_to_transaction_type() - - self.history.go(data=JSON({ + data = JSON({ "ibanCrypte": account.id, "pastOrPending": 1, "triAV": 0, "startDate": (datetime.now() - relativedelta(years=1)).strftime('%d%m%Y'), "endDate": datetime.now().strftime('%d%m%Y') - })) + }) + try: + self.history.go(data=data) + except BrowserUnavailable: + # old url is still used for certain connections bu we don't know which one is, + # so the same HistoryPage is attained by the old url in another URL object + data[1]['startDate'] = (datetime.now() - relativedelta(years=3)).strftime('%d%m%Y') + # old url authorizes up to 3 years of history + self.history_old.go(data=data) if coming: return sorted_transactions(self.page.iter_coming()) -- GitLab