applaud icon indicating copy to clipboard operation
applaud copied to clipboard

KeyError: 'content-disposition' when I tried to download Sales report

Open uituit opened this issue 1 year ago • 1 comments

Thank you for the great work! I've been using the applaud library in the last 2 years to download reports from App Store Connect. It really is a time-saver and streamlined the workflow.

However, when I tried to download the Sales report of last month, a KeyError: 'content-disposition' shows up, with errors from:

applaud\endpoints\sales_reports.py", line 77, in get return super()._perform_get(stream=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\applaud\endpoints\base.py", line 102, in _perform_get return self.__parse_response(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\applaud\endpoints\base.py", line 89, in __parse_response return GzipStreamResponse(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\applaud\schemas\responses.py", line 18, in __init__ self.default_gzip_filename = response.headers.get('x-reports-filename') or response.headers['Content-Disposition'].split('filename=')[1].strip('"') ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^

\site-packages\requests\structures.py", line 52, in __getitem__ return self._store[key.lower()][1] ~~~~~~~~~~~^^^^^^^^^^^^^

It appears to me that it is not getting the gzip file from Apple correctly.

May I know if anyone knows how it can be fixed?

uituit avatar Jan 08 '25 13:01 uituit

Change it to .get('Content-Disposition') and if both headers are missing, use a default filename

kajensen avatar Mar 13 '25 18:03 kajensen