From 39d0a9311a6c5dcc8f06e49fa2d41be16dba6bbf Mon Sep 17 00:00:00 2001 From: Guillaume Risbourg Date: Thu, 26 Dec 2019 17:46:57 +0100 Subject: [PATCH] [lcl] Changed transactions details link The link we retrieve from the HTML is really unstable and has a lot of HTTP Error 500. The new link (used by the website for elements that do not have `href` attributes) works fine. --- modules/lcl/browser.py | 2 +- modules/lcl/pages.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/lcl/browser.py b/modules/lcl/browser.py index a2a513a38b..b53bbeb8b7 100644 --- a/modules/lcl/browser.py +++ b/modules/lcl/browser.py @@ -71,7 +71,7 @@ class LCLBrowser(LoginBrowser, StatesMixin): accounts = URL(r'/outil/UWSP/Synthese', AccountsPage) client = URL(r'/outil/uwho', ClientPage) history = URL( - r'/outil/UWLM/ListeMouvements.*/accesListeMouvements.*', + r'/outil/UWLM/ListeMouvements.*/acces(ListeMouvements|DetailsMouvement).*', r'/outil/UWLM/DetailMouvement.*/accesDetailMouvement.*', r'/outil/UWLM/Rebond', AccountHistoryPage) diff --git a/modules/lcl/pages.py b/modules/lcl/pages.py index 2727f58581..dea0a9c680 100644 --- a/modules/lcl/pages.py +++ b/modules/lcl/pages.py @@ -464,11 +464,12 @@ class _get_operations(Pagination, Transaction.TransactionsElement): class item(Transaction.TransactionElement): def load_details(self): - link = Attr('.', 'href', default=None)(self) - if not link: - self.logger.warning('Found operation without detail url.') - return None - return self.page.browser.async_open(link, method='POST') + row = Attr('.', 'id', default=None)(self) + assert row, 'HTML format of transactions details changed' + return self.page.browser.async_open( + '/outil/UWLM/ListeMouvementsParticulier/accesDetailsMouvement?element=%s' % row, + method='POST', + ) def obj_type(self): type = Async('details', CleanText(u'//td[contains(text(), "Nature de l\'opération")]/following-sibling::*[1]'))(self) -- GitLab