ING DIBA - get_holdings method broken
Hi Raphael, hi everybody,
thanks for this great project. Recently I found the get_holdings method is not working anymore for the ING.
Problem:
It seems they return bytes instead of strings:
TypeError: descriptor 'splitlines' requires a 'str' object but received a 'bytes'
Hence, the following line in client.py doesn't work anymore for me:
mt535_lines = str.splitlines(resp.holdings)
Solution:
with the following (dirty) hack:
try:
mt535_lines = str.splitlines(resp.holdings)
del mt535_lines[0] # The first line is empty - drop it.
except:
mt535_lines = str(resp).split('\\r\\n')
mt535_lines = mt535_lines[:-1] # The last line is empty - drop it.
it works again. Would be great to have this, or in another (better) way implemented.
Thank you very much in advance and best wishes, Mat
Hi @matwid, thanks for reporting! I can't really work on this function as I don't have a bank account that supports it.
Can you check if it's sufficient to just replace str.splitlines(resp.holdings) by str.splitlines(resp.holdings.decode())? The type change might be a side effect of the parser rewrite in 2.0.
Hi Raphael, I experienced the same bug as @matwid (but I did a different workaround), and I can confirm your change works for the bank account I use.
However, I have two bank accounts which yield different resp types when querying the holdings, and in that case I have to resort to the original code. My workaround in client.py (lines 626 and below) introduces an if-else clause and looks therefore like that:
for resp in responses:
if type(resp.holdings) == bytes:
holding_str = resp.holdings.decode()
else:
holding_str = resp.holdings
mt535_lines = str.splitlines(holding_str)
# The first line is empty - drop it.
del mt535_lines[0]
....
Hope that helps.
Hi @foo-git and @matwid,
can i ask you both, how you pass the TAN at the ING?
Exception: Cannot change TAN mechanism with a standing dialog
The above exception was the direct cause of the following exception:
I always get this Exception.
Grretings, Tricade