python-fints icon indicating copy to clipboard operation
python-fints copied to clipboard

ING DIBA - get_holdings method broken

Open matwid opened this issue 6 years ago • 3 comments

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

matwid avatar Jul 08 '19 12:07 matwid

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.

raphaelm avatar Jul 15 '19 15:07 raphaelm

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.

foo-git avatar Jul 19 '19 20:07 foo-git

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

Tricade avatar Feb 11 '20 21:02 Tricade