Frappeclient - get_api - frappe.utils.print_format.download_pdf - error + solution

Hi !

Using the “frappeclient.get_api” with method “frappe.utils.print_format.download_pdf” will try to return self.post_process(res) in stmt 177. Because the response is a PDF-Stream the self.post_process will dump with ValueError Stmt 209 when it tries to convert to json.

The right return value should be response.content.

I’ve tried it with a separate method (get_api_pdf) returning response.content and everything works fine.

1 Like

It would be better if you also provide a script.