mitsuhiko / flatex-pdf-download

some code to toy with that can download flatex.at pdfs
Apache License 2.0
43 stars 8 forks source link

--csv throws an exception #14

Open wilhelmy opened 2 weeks ago

wilhelmy commented 2 weeks ago

Hi,

I've added a print(json) before the offending statment. Looks like this redirect isn't handled but the error is caused by trying to index an empty command.

{'commands': [{'command': 'redirect', 'location': 'https://www.flatex.at/?id=18136&windowId=W68492'}]}
{}
Traceback (most recent call last):
  File "/home/mw/src/foreign/flatex-pdf-download/flatex-fetch.py", line 295, in <module>
    cli()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mw/src/foreign/flatex-pdf-download/flatex-fetch.py", line 285, in cli
    downloaded = fetcher.download_csv(csv, days=days)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mw/src/foreign/flatex-pdf-download/flatex-fetch.py", line 225, in download_csv
    rv = self._request(
         ^^^^^^^^^^^^^^
  File "/home/mw/src/foreign/flatex-pdf-download/flatex-fetch.py", line 100, in _request
    for command in json["commands"]:
                   ~~~~^^^^^^^^^^^^
KeyError: 'commands'

PS: I haven't had any luck with PDF download either, the pdfs directory shows up empty. Is this project abandoned?