boursorama: support website changes
This commit is contained in:
parent
8862811566
commit
11a161c1b1
4 changed files with 27 additions and 45 deletions
|
|
@ -55,10 +55,13 @@ class Boursorama(BaseBrowser):
|
|||
BaseBrowser.__init__(self, *args, **kwargs)
|
||||
|
||||
def home(self):
|
||||
self.location('https://' + self.DOMAIN + '/connexion.phtml')
|
||||
if not self.is_logged():
|
||||
self.login()
|
||||
else:
|
||||
self.location('https://' + self.DOMAIN + '/comptes/synthese.phtml')
|
||||
|
||||
def is_logged(self):
|
||||
return not self.is_on_page(LoginPage)
|
||||
return self.page is not None and not self.is_on_page(LoginPage)
|
||||
|
||||
def handle_authentication(self):
|
||||
if self.is_on_page(AuthenticationPage):
|
||||
|
|
@ -91,7 +94,7 @@ class Boursorama(BaseBrowser):
|
|||
assert self.password.isdigit()
|
||||
|
||||
if not self.is_on_page(LoginPage):
|
||||
self.location('https://' + self.DOMAIN + '/connexion.phtml')
|
||||
self.location('https://' + self.DOMAIN + '/connexion.phtml', no_login=True)
|
||||
|
||||
self.page.login(self.username, self.password)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
|
||||
from urlparse import urlparse
|
||||
from datetime import date
|
||||
import re
|
||||
|
||||
from weboob.tools.browser import BasePage
|
||||
|
|
@ -45,45 +44,26 @@ class Transaction(FrenchTransaction):
|
|||
|
||||
|
||||
class AccountHistory(BasePage):
|
||||
|
||||
def on_loaded(self):
|
||||
self.operations = []
|
||||
|
||||
for form in self.document.getiterator('form'):
|
||||
if form.attrib.get('name', '') == 'marques':
|
||||
for tr in form.getiterator('tr'):
|
||||
tds = tr.findall('td')
|
||||
if len(tds) < 5:
|
||||
continue
|
||||
# tds[0]: operation
|
||||
# tds[1]: valeur
|
||||
d = date(*reversed([int(x) for x in tds[1].text.split('/')]))
|
||||
labeldiv = tds[2].find('div')
|
||||
if len(tds) == 6:
|
||||
inputid = tds[5].find('input[@type="hidden"]')
|
||||
operation = Transaction(inputid.attrib['id'].split('_')[1])
|
||||
else:
|
||||
operation = Transaction(0)
|
||||
label = u''
|
||||
label += labeldiv.text
|
||||
if labeldiv.find('a') is not None:
|
||||
label += labeldiv.find('a').text
|
||||
label = label.strip(u' \n\t')
|
||||
|
||||
category = labeldiv.attrib.get('title', '')
|
||||
useless, sep, category = [part.strip() for part in category.partition(':')]
|
||||
|
||||
debit = tds[3].text or ""
|
||||
credit = tds[4].text or ""
|
||||
|
||||
operation.parse(date=d, raw=label)
|
||||
operation.set_amount(credit, debit)
|
||||
operation.category = category
|
||||
|
||||
self.operations.append(operation)
|
||||
|
||||
def get_operations(self):
|
||||
return self.operations
|
||||
for form in self.document.xpath('//form[@name="marques"]'):
|
||||
for tr in form.xpath('.//tbody/tr'):
|
||||
if tr.attrib.get('class', '') == 'total':
|
||||
continue
|
||||
|
||||
date = self.parser.tocleanstring(tr.cssselect('td.label span.DateOperation')[0])
|
||||
label = self.parser.tocleanstring(tr.cssselect('td.label span')[-1])
|
||||
amount = self.parser.tocleanstring(tr.cssselect('td.amount')[0])
|
||||
|
||||
try:
|
||||
_id = tr.xpath('.//input[@type="hidden"]')[0].attrib['id'].split('_')[1]
|
||||
except KeyError:
|
||||
_id = 0
|
||||
|
||||
operation = Transaction(_id)
|
||||
operation.parse(date=date, raw=label)
|
||||
operation.set_amount(amount)
|
||||
|
||||
yield operation
|
||||
|
||||
def get_next_url(self):
|
||||
items = self.document.getroot().cssselect('ul.menu-lvl-0 li')
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ from decimal import Decimal
|
|||
|
||||
from weboob.capabilities.bank import Account
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.tools.misc import to_unicode
|
||||
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||
|
||||
|
||||
|
|
@ -43,8 +42,8 @@ class AccountsList(BasePage):
|
|||
break
|
||||
|
||||
elif td.attrib.get('class', '') == 'account-name':
|
||||
a = td.find('a')
|
||||
account.label = to_unicode(a.text)
|
||||
account.label = self.parser.tocleanstring(td.xpath('./span[@class="label"]')[0])
|
||||
account._link_id = td.xpath('.//a')[0].attrib['href']
|
||||
|
||||
elif td.attrib.get('class', '') == 'account-more-actions':
|
||||
for a in td.getiterator('a'):
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class VirtKeyboard(MappedVirtKeyboard):
|
|||
return r > 240 and g > 240 and b > 240
|
||||
|
||||
def __init__(self, page):
|
||||
img = page.document.find("//img[@usemap='#pass_map']")
|
||||
img = page.document.find("//img[@usemap='#login-pad_map']")
|
||||
img_file = page.browser.openurl(img.attrib['src'])
|
||||
MappedVirtKeyboard.__init__(self, img_file, page.document, img, self.color, convert='RGB')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue