Commit 1f930449 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Vincent A

[ing] better fix for 500 errors encountered after visiting life insurances

First, don't go on a non-LoggedPage at the end of iter_accounts, it can only
lead to being delogged mindlessly.

The real problem is the site fails with a 500 when a Referer doesn not point
to /secure (what a bunch of idiots), and the life insurances URL doesn't
have /secure, so after visiting them with go(), we set a bad Referer.
Use open() instead, so the Referer is not set to a "bad" URL.
parent bac4113c
......@@ -309,20 +309,18 @@ class IngAPIBrowser(LoginBrowser, StatesMixin):
# If the balance is 0, the details page throws an error 500
if account.type == Account.TYPE_LIFE_INSURANCE:
if account.balance != 0:
# Prefer do an open() NOT to set the life insurance url as next Referer.
# If the Referer doesn't point to /secure, the site might do error 500...
page =
'Authorization': 'Bearer %s' % self.get_invest_token(),
yield account
# The life insurance page is on a different space,
# sometimes we get an error 500 if we don't go back to this page
def iter_matching_accounts(self):
"""Do accounts matching for old and new website"""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment