Commit d1b4db0c authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[spirica] Corrected history pagination and transaction invests

Several elements have changed on the Spirica website:
- the "Tout afficher" button disappeared,
- the forms to get the transactions list were modified,
- the forms to get investments for each transaction changed.
This patch corrects history for each account as well as the respective
parent 5752d4e1
......@@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <>.
from __future__ import unicode_literals
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
......@@ -37,7 +38,6 @@ class SpiricaBrowser(LoginBrowser):
self.BASEURL = website
self.cache = {}
self.cache['invs'] = {}
self.cache['trs'] = {}
def do_login(self):
self.login.go().login(self.username, self.password)
......@@ -51,9 +51,7 @@ class SpiricaBrowser(LoginBrowser):
def iter_accounts(self):
if 'accs' not in self.cache.keys():
self.cache['accs'] = [a for a in self.accounts.stay_or_go().iter_accounts()]
return self.cache['accs']
return self.accounts.go().iter_accounts()
def iter_investment(self, account):
......@@ -69,14 +67,24 @@ class SpiricaBrowser(LoginBrowser):
def iter_history(self, account):
if not in self.cache['trs']:
# Get form to show all transactions
trs = [t for t in]
self.cache['trs'][] = trs
return self.cache['trs'][]
transaction_page =
# Determining the number of transaction pages:
total_pages = int( // 100
# Scraping transactions for each page:
for page_number in range(total_pages + 1):
for transaction in
transaction_page.go_investments_form(transaction._index) = []
for inv in
# Only keep investments that have at least a label and a valuation:
if inv.label and inv.valuation:
yield transaction
def fill_from_list(self, invs, objects_list):
matching_fields = ['code', 'unitvalue', 'label', '_gestion_type']
This diff is collapsed.
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