use the lxml parser (elementtidy is now deprecated)
This commit is contained in:
parent
6edafa89a2
commit
16318dcbf6
2 changed files with 2 additions and 12 deletions
|
|
@ -21,17 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
|
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
|
||||||
from weboob.tools.parsers.elementtidyparser import ElementTidyParser
|
|
||||||
from weboob.backends.bnporc import pages
|
from weboob.backends.bnporc import pages
|
||||||
|
|
||||||
# Parser
|
|
||||||
class BNParser(ElementTidyParser):
|
|
||||||
def parse(self, data, encoding):
|
|
||||||
s = data.read()
|
|
||||||
s = s.replace('<?Pub Caret>', '')
|
|
||||||
data = StringIO(s)
|
|
||||||
return ElementTidyParser.parse(self, data, encoding)
|
|
||||||
|
|
||||||
# Browser
|
# Browser
|
||||||
class BNPorc(BaseBrowser):
|
class BNPorc(BaseBrowser):
|
||||||
DOMAIN = 'www.secure.bnpparibas.net'
|
DOMAIN = 'www.secure.bnpparibas.net'
|
||||||
|
|
@ -49,7 +40,6 @@ class BNPorc(BaseBrowser):
|
||||||
is_logging = False
|
is_logging = False
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
kwargs['parser'] = BNParser()
|
|
||||||
kwargs['history'] = None # need history
|
kwargs['history'] = None # need history
|
||||||
BaseBrowser.__init__(self, *args, **kwargs)
|
BaseBrowser.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ class AccountComing(BasePage):
|
||||||
|
|
||||||
for tr in self.document.getiterator('tr'):
|
for tr in self.document.getiterator('tr'):
|
||||||
if tr.attrib.get('class', '') == 'hdoc1' or tr.attrib.get('class', '') == 'hdotc1':
|
if tr.attrib.get('class', '') == 'hdoc1' or tr.attrib.get('class', '') == 'hdotc1':
|
||||||
operation = Operation()
|
|
||||||
tds = tr.findall('td')
|
tds = tr.findall('td')
|
||||||
if len(tds) != 3:
|
if len(tds) != 3:
|
||||||
continue
|
continue
|
||||||
|
|
@ -38,10 +37,11 @@ class AccountComing(BasePage):
|
||||||
for child in tds[1].getchildren():
|
for child in tds[1].getchildren():
|
||||||
if child.text: label += child.text
|
if child.text: label += child.text
|
||||||
if child.tail: label += child.tail
|
if child.tail: label += child.tail
|
||||||
label += tds[1].tail
|
if tds[1].tail: label += tds[1].tail
|
||||||
label = label.strip()
|
label = label.strip()
|
||||||
amount = tds[2].text.replace('.','').replace(',','.')
|
amount = tds[2].text.replace('.','').replace(',','.')
|
||||||
|
|
||||||
|
operation = Operation()
|
||||||
operation.setDate(date)
|
operation.setDate(date)
|
||||||
operation.setLabel(label)
|
operation.setLabel(label)
|
||||||
operation.setAmount(float(amount))
|
operation.setAmount(float(amount))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue