From b39d16e959aa78aabfd403fb42e935f645ec7aac Mon Sep 17 00:00:00 2001 From: Damien Mat Date: Tue, 8 Oct 2019 15:53:23 +0200 Subject: [PATCH] [esalia] Fix nav between several investments accounts popups Investments performances in this module can be fecthed by launching 3 different popups depending on the user's contrats. When wanting the investments we first collect the urls of each popup then follow each one and parse the performances from there. When the user has sggestion.com and lyxorfunds.com invests with first url fetched being lyxorfunds.com, at the time to follow it, the request would not be accepted and return a ClientError. If the urls are fetched the other way around, the requests would work, this is the most cases behavior. In order to make lyxorfunds.com requests to work everytime we need the referer from homepage (AccountsPage). --- modules/s2e/browser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/s2e/browser.py b/modules/s2e/browser.py index 6a6b0e4d4a..c3b0c3bdd7 100644 --- a/modules/s2e/browser.py +++ b/modules/s2e/browser.py @@ -165,7 +165,8 @@ def update_investments(self, investments): elif self.amfcode_sg.match(inv._link) or self.lyxorfunds.match(inv._link): # Esalia (Société Générale Épargne Salariale) or Lyxor investments # Not all sggestion-ede.com or lyxorfunds.com have available performances. - self.location(inv._link) + # For those requests to work in every case we need the headers from AccountsPage + self.location(inv._link, headers={'Referer': self.accounts.build(slug=self.SLUG)}) inv.performance_history = self.page.get_investment_performances() return investments -- GitLab