azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

Unclear how to parse multipart form-data

Open tjhgit opened this issue 6 years ago • 2 comments

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 :(

tjhgit avatar Feb 08 '19 21:02 tjhgit

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!

fabiocav avatar Apr 15 '21 21:04 fabiocav

This may also help: https://stackoverflow.com/questions/61790607/how-do-i-receive-multipart-form-data-in-azure-function

fabiocav avatar Apr 15 '21 21:04 fabiocav