hoffie / dkb-visa

DKB transaction download and conversion (CSV, QIF)
GNU Affero General Public License v3.0
56 stars 26 forks source link

IndexError: list index out of range #3

Closed uwe-schwarz closed 9 years ago

uwe-schwarz commented 9 years ago

I get the following trace when starting:

Traceback (most recent call last): File "/home/uwe/dkb-banking/dkb-visa/dkb.py", line 413, in fetcher.login(args.userid, pin) File "/home/uwe/dkb-banking/dkb-visa/dkb.py", line 61, in login br.form = list(br.forms())[0] IndexError: list index out of range

hoffie commented 9 years ago

Thanks for the report. I am not using this package daily and did not notice it until now.

The issue is caused by a syntax error in DKB's HTML, which confuses even the error-tolerant mechanize and beautifulsoup libs. I see no sane way besides manually fixing this. As you can see, I have just committed a workaround, which does exactly this. I will also try to reach out to dkb if they intend to fix this on their side so that we can drop the fix again.

See https://validator.w3.org/nu/?doc=https%3A%2F%2Fbanking.dkb.de%2Fdkb%2F-%3F%24javascript%3Ddisabled list item 13. The broken IE conditional comment <![endif--> probably makes mechanize interpret the whole document as part of this "comment" so that there is no real content left. The conditional comment is part of the normal HTML and not part of an ordinary HTML comment, in which case parsers would just ignore it (except for IE).

uwe-schwarz commented 9 years ago

Thanks for debugging. I just tested the fix and it works perfectly.