From f6591c6c1ceebc793556e50a94f4d0ff474bdfd7 Mon Sep 17 00:00:00 2001 From: Vincent Ardisson Date: Thu, 9 May 2019 12:23:58 +0200 Subject: [PATCH] [caissedepargne] use DST in URL for revolving loans Yes, these idiots really require a human-formatted date time with the timezone present in the URL. Else they return a 520 code. We should use the "babel" library to format it correctly instead of hardcoding. --- modules/caissedepargne/browser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/caissedepargne/browser.py b/modules/caissedepargne/browser.py index c9297302e5..2758019cdd 100644 --- a/modules/caissedepargne/browser.py +++ b/modules/caissedepargne/browser.py @@ -69,7 +69,7 @@ class CaisseEpargne(LoginBrowser, StatesMixin): 'https://.*/login.aspx', LoginPage) account_login = URL('/authentification/manage\?step=account&identifiant=(?P.*)&account=(?P.*)', LoginPage) loading = URL('https://.*/CreditConso/ReroutageCreditConso.aspx', LoadingPage) - cons_loan = URL('https://www.credit-conso-cr.caisse-epargne.fr/websavcr-web/rest/contrat/getContrat\?datePourIe(?P)', ConsLoanPage) + cons_loan = URL('https://www.credit-conso-cr.caisse-epargne.fr/websavcr-web/rest/contrat/getContrat\?datePourIe=(?P)', ConsLoanPage) transaction_detail = URL('https://.*/Portail.aspx.*', TransactionsDetailsPage) recipient = URL('https://.*/Portail.aspx.*', RecipientPage) transfer = URL('https://.*/Portail.aspx.*', TransferPage) @@ -333,7 +333,10 @@ def loans_conso(self): days = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun') month = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') now = datetime.datetime.today() - d = '%s %s %s %s %s:%s:%s GMT+0100 (heure normale d’Europe centrale)' % (days[now.weekday()], now.day, month[now.month - 1], now.year, now.hour, format(now.minute, "02"), now.second) + # for non-DST + # d = '%s %s %s %s %s:%s:%s GMT+0100 (heure normale d’Europe centrale)' % (days[now.weekday()], now.day, month[now.month - 1], now.year, now.hour, format(now.minute, "02"), now.second) + # TODO use babel library to simplify this code + d = '%s %s %s %s %s:%s:%s GMT+0200 (heure d’été d’Europe centrale)' % (days[now.weekday()], now.day, month[now.month - 1], now.year, now.hour, format(now.minute, "02"), now.second) if self.home.is_here(): msg = self.page.loan_unavailable_msg() if msg: -- GitLab