azure-functions-python-worker
azure-functions-python-worker copied to clipboard
Unclear how to parse multipart form-data
Hi,
I am sending an image with multipart form-data to an azure function based on linux docker container. It is not clear to me how I can parse the multipart binary contained in req.get_body(). Can you help?
What I am currently doing is really hacky:
end_pat = b'IEND\xaeB`\x82'
img_body = body[body.find(b'\x89PNG'):body.find(end_pat) + len(end_pat)]
That is I am extracting the image by a byte search :(
Apologies for the delayed response. This should have been kept in the Python repo, so I'll transfer it back.
@Hazhzeng can you please follow up on this? Thanks!
This may also help: https://stackoverflow.com/questions/61790607/how-do-i-receive-multipart-form-data-in-azure-function