Comments (7)
@siddhantgoel thanks for reviewing and merging the changes! Now that it is merged, I'm closing the issue.
from streaming-form-data.
At the moment the parser passes everything unknown to a NullTarget()
so it should definitely be possible to raise an error instead. I have the feeling though that raising an error has the potential to break existing code.
There could be the case where a form contains 5 fields and on the backend we only care about the performance for 4 fields and the fifth field is outside the scope of this library. Maybe a warnings.warn()
call would be a lightweight alternative of achieving a similar thing?
from streaming-form-data.
I agree that it should not be the default behavior. For example in the flask-restx
library there is a flag for the parser called strict
and by default it is false. When you set it to true, it raises an exception when an unknown field is provided. Doing it that way would be backwards compatible as well. However I do not have any strong preference, as long as I can catch the error one way or another.
from streaming-form-data.
I do like the idea of a strict
mode. Would you be up for opening a PR? I think there are very few function signatures we'd need to adjust, and then update the documentation.
from streaming-form-data.
Sure, then I'll try to implement it. I always wanted to test Cython as long as you review why not :D
from streaming-form-data.
Awesome! 🎉
Just something to get you started with: the streaming_form_data.parser.Parser
class is the Python entry-point while the _Parser
class is the one running in Cython space. There's a streaming_form_data._parser._Parser._part_for
method that is called to get the current Part
(basically the current chunk of input being uploaded) while the parsing is being done to feed it some bytes. Inside the parsing loop there's a part = self._part_for(name) or self.default_part
check so that's probably where you would need to return an error.
Let me know if there's anything I can help with and looking forward to seeing that PR!
from streaming-form-data.
Thanks a lot, I will look into those!
from streaming-form-data.
Related Issues (20)
- How to use it with FastAPI? HOT 4
- Build fails without Python2 headers HOT 5
- Ubuntu Server slow speed HOT 1
- How do you read file name? HOT 2
- Support for AsyncIO HOT 2
- Install failure with pip 20 and setuptools 46 HOT 8
- __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) A wheel is created for you to put on pypi. HOT 6
- Any ideas how to deal with excel files in streaming ? HOT 1
- Get file name HOT 2
- Handling multi-valued fields? HOT 10
- Parser won't get registered and receive chunk data as a flask_appbuilder app in airflow webserver ui HOT 5
- How to use to read image file? HOT 2
- Move C declarations to a .pxd file to be available to other Cython modules. HOT 7
- Question: Does it support to parse raw multipart/form-data bodies ? HOT 5
- handler _parser.data_received failed with delimiting multipart stream into parts HOT 1
- `cgi` is being deprecated in 3.13 HOT 1
- smart-open as an optional dependency HOT 3
- How to validate content-type? HOT 7
- Fails to install with PyPy 3.10 on Windows HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streaming-form-data.