New submission from Abhilash Raj <raj.abhila...@gmail.com>:
When using `urllib.parse.urlencode` it is impossible to pass an empty list when doseq=True. So, I see the following behavior when using urlencode: In [3]: urlencode({'key': ['value']}, doseq=True) Out[3]: 'key=value' In [4]: urlencode({'key': []}, doseq=True) Out[4]: '' So, in our source code, we do urlecode(params, doseq=True), which can have keys with empty list as values and it gets dropped completely. To get it to work properly, I instead pass around an empty string as a value when the length of list is 0, which conveys the server that the value of the key is empty. I wonder if it would make sense for urlencode to do that by default given doseq=True is meant to encode lists properly. ---------- messages: 318153 nosy: maxking priority: normal severity: normal status: open title: urlib.parse.urlencode with empty list and doseq=True drops the parameter type: behavior versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33690> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com