I am trying to develop a flask server which generates a presentation object based on json data and files from a HTTP Post request. I am able to generate the file locally with same code but when I try to send it as an http response is fails.
Here is the code snippet for sending it as an http response -
prs_file_io = BytesIO()
prs.save(prs_file_io)
resp = Response()
resp.status_code = 200
resp.set_data(prs_file_io.getvalue())
return resp
And here is the python script sending the request and trying to save the file -
r = requests.post('http://localhost:8181/create-ppt',
#data=open('tile_resp.json', 'rb'),
files={'1': open('./0NtNFb0F9ch15fDrgYoECEpctPkjvayD.png', 'rb'),
'tile_data': open('tile_resp.json', 'rb')})
print(r.content)
And finally I pipe the output from request script to a pptx file.
But this is not working any idea what mistake I am making here?