Commit fe93d9a0 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Romain Bignon

[ing] port to python3

parent 9d71f984
......@@ -42,7 +42,7 @@ def start_with_main_site(f):
browser = args[0]
if browser.url and browser.url.startswith(''):
for i in xrange(3):
for i in range(3):
except ServerError:
......@@ -104,9 +104,6 @@ class IngBrowser(LoginBrowser):
self.cache["investments_data"] = {}
def do_login(self):
assert isinstance(self.username, basestring)
assert isinstance(self.password, basestring)
assert isinstance(self.birthday, basestring)
assert self.password.isdigit()
assert self.birthday.isdigit()
......@@ -214,14 +211,14 @@ class IngBrowser(LoginBrowser):
history_function = AccountsList.get_transactions_others
index = 0
hashlist = []
hashlist = set()
while True:
i = index
for transaction in history_function(, index=index): = hashlib.md5(transaction._hash).hexdigest()
while in hashlist: = hashlib.md5( + "1").hexdigest()
hashlist.append( = hashlib.md5(( + "1").encode('ascii')).hexdigest()
i += 1
yield transaction
# if there is no more transactions, it is useless to continue
......@@ -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
import re
from decimal import Decimal
......@@ -28,6 +29,7 @@ from weboob.browser.elements import ListElement, TableElement, ItemElement, meth
from weboob.browser.filters.standard import CleanDecimal, CleanText, Date, TableCell, Regexp, Env, Async, AsyncLoad
from weboob.browser.filters.html import Link, Attr
from import FrenchTransaction
from import unicode
class NetissimaPage(HTMLPage):
......@@ -42,6 +44,9 @@ class TitreValuePage(LoggedPage, HTMLPage):
class TitrePage(LoggedPage, RawPage):
def build_doc(self, content):
return content.decode(self.encoding)
def get_balance(self):
return CleanDecimal(default=None, replace_dots=True).filter(self.doc.split('{')[0])
......@@ -69,15 +74,15 @@ class TitrePage(LoggedPage, RawPage):
_pl = columns[start].split('{')[1]
_id = columns[start].split('{')[2]
invest = Investment()
invest.label = unicode(columns[start].split('{')[-1])
invest.code = unicode(_id) if _id is not None else NotAvailable
invest.label = columns[start].split('{')[-1]
invest.code = _id or NotAvailable
if invest.code and ':' in invest.code:
invest.code =,pl=_pl).get_isin()
# The code we got is not a real ISIN code.
if invest.code and not re.match('^[A-Z]{2}[\d]{10}$|^[A-Z]{2}[\d]{5}[A-Z]{1}[\d]{4}$', invest.code):
m ='\{([A-Z]{2}[\d]{10})\{|\{([A-Z]{2}[\d]{5}[A-Z]{1}[\d]{4})\{', line)
if m:
invest.code = unicode( or
invest.code = or
for x, attr in enumerate(['quantity', 'unitprice', 'unitvalue', 'valuation', 'diff'], 1):
currency = FrenchTransaction.Currency().filter(columns[start + x])
......@@ -106,8 +111,8 @@ class TitrePage(LoggedPage, RawPage):
#We also have to get the liquidity as an investment.
invest = Investment()
invest.label = unicode("Liquidités", 'utf-8')
invest.code = unicode("XX-liquidity")
invest.label = "Liquidités"
invest.code = "XX-liquidity"
invest.valuation = CleanDecimal(None, True).filter(message.split('&')[3].replace('euro;{','').strip())
for invest in invests:
......@@ -125,7 +125,7 @@ class TransferPage(LoggedPage, HTMLPage):
form = self.get_form()
keys = [k for k in form.iterkeys() if '_link_hidden' in k or 'j_idcl' in k]
keys = [k for k in form if '_link_hidden' in k or 'j_idcl' in k]
for k in keys:
form['AJAXREQUEST'] = "_viewRoot"
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