Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Does it support to parse raw multipart/form-data bodies ? #68

Open
aprilahijriyan opened this issue Jan 23, 2023 · 5 comments

Comments

@aprilahijriyan
Copy link

Does it support to parse form-data without knowing the "parameter name" like https://github.com/andrew-d/python-multipart ?

thank you

@siddhantgoel
Copy link
Owner

At the moment it does not. PRs/discussion welcome though!

@aprilahijriyan
Copy link
Author

Hi, sorry for slow response.

I was just wondering if there is a module to increase the performance of parsing multipart/form-data requests that can be combined with "other frameworks". Literally parsing the raw body of multipart/form-data just like the python-multipart module does.

I'm currently experimenting, creating a web framework based on ASGI. To parse the multipart/form-data query I followed the starlette framework. You can see it here: https://github.com/aprilahijriyan/allin/blob/main/allin/parser.py#L88

I'm asking about this because I wanted to try using your module to see how it performs. ✌🏽

I suggest it might be better to follow what the python-multipart module does. such as adding a callback to hold all the data contained in it.

@siddhantgoel
Copy link
Owner

So to confirm if I understood correctly, the callback function would dynamically decide (based on the field name) what to do with the contained data?

If that's the case, that might not work as well in case someone uploads a huge file which would all end up being stored in memory. Streaming it directly to a file keeps the memory usage low.

@lloydzhou
Copy link

what to do with the contained data?

store data in tempfile.NamedTemporaryFile ?

@siddhantgoel
Copy link
Owner

I didn't mean that as a question. I meant it more in the sense of confirming what @aprilahijriyan was referring to.

Unless you were referring to some other workflow, in which case maybe you could leave a bit more detail on how that process would work with storing data in a temp file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants