The new woob repository is here: This gitlab will be removed soon.

Commit ac5161f0 authored by Benjamin Tampigny's avatar Benjamin Tampigny Committed by Vincent A

|cmso] don't crash the second time market history is requested

Since the error is now handled properly, the try except is not useful
anymore, I deleted it
parent 85e6031f
......@@ -330,11 +330,15 @@ def iter_accounts(self):
return self.accounts_list
def _go_market_history(self):
content ={'place': 'SITUATION_PORTEFEUILLE'}).text
return, action='historiquePortefeuille')
def _go_market_history(self, action):
# the website won't let us go on market page if we don't do this call before (it raises a 403)
url_before_market_history = json.loads({'place': 'SITUATION_PORTEFEUILLE'}).text)['urlSSO']
except KeyError:
raise AssertionError('unable to get url to reach to be able to go on market page')
return, action=action)
@retry((ClientError, ServerError))
......@@ -355,7 +359,7 @@ def iter_history(self, account):
yield tr
elif account.type in (Account.TYPE_PEA, Account.TYPE_MARKET):
if not, account._owner):
......@@ -417,10 +421,12 @@ def iter_coming(self, account):
return []
comings = []
if not hasattr(account, '_index'):
# No _index, we can't get coming
return []
elif account.type in (Account.TYPE_PEA, Account.TYPE_MARKET):
# will prevent a further 403
self.history.go(json={"index": account._index}, page="pendingListOperations")
# There is no ids for comings, so no check for duplicates
for key in
......@@ -450,10 +456,7 @@ def iter_investment(self, account):
return []
return self.location(url).page.iter_investment()
elif account.type in (Account.TYPE_MARKET, Account.TYPE_PEA):
data = {"place": "SITUATION_PORTEFEUILLE"}
response =
self.location(json.loads(response.text)['urlSSO']), action="situationPortefeuille")
if, account._owner):
return []
......@@ -465,10 +468,7 @@ def iter_market_orders(self, account):
if account.type not in (Account.TYPE_MARKET, Account.TYPE_PEA):
data = {"place": "SITUATION_PORTEFEUILLE"}
response =
self.location(json.loads(response.text)['urlSSO']), action="carnetOrdre")
if, account._owner):
orders_list_url = self.url
error_message =
......@@ -38,7 +38,7 @@
from weboob.browser.filters.json import Dict
from weboob.browser.filters.html import Attr, Link, TableCell, AbsoluteLink
from weboob.browser.exceptions import ServerError, ClientError
from weboob.browser.exceptions import ServerError
from import Account, Loan, AccountOwnership
from weboob.capabilities.wealth import Investment, MarketOrder, MarketOrderDirection, MarketOrderType
from import Advisor
......@@ -289,16 +289,7 @@ def obj_ownership(self):
def get_market_number(self):
label = Field('label')(self)
# sometimes this call raises a ClientError. it does not really disconnect the browser
# in order to prevent a new login attempt from the browser and a reset of the iter_accounts
# we handle the exception here
page =
except ClientError as e:
if e.response.status_code == 403:
self.logger.warning("unable to retrieve market number for account with label %s", label)
return NotAvailable
page ='historiquePortefeuille')
return page.get_account_id(label, Field('_owner')(self))
def get_lifenumber(self):
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