I am hitting an API, from where I am receiving pdf file, When I try to convert the binary data received from API to PDF File using below.
resp = request.get(url=url)
with open('test.pdf', 'wb') as pdffile:
pdffile.write(resp.content)
However with this approach file is being save but data is incomplete. Also I am doing this on web application, I don't want to save the file on server, just wanna keep it in buffer memory and store it in a binary field.
Please let me know if anymore information is needed, I am using Odoo ERP system.
Thank you in Advance.
Binary Data Format starts with b'%PDF-1.6
You might be able to use a BytesIO object