Author maxking
Recipients maxking
Date 2018-05-30.04:57:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527656245.94.0.682650639539.issue33690@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-05-30 04:57:25maxkingsetrecipients: + maxking
2018-05-30 04:57:25maxkingsetmessageid: <1527656245.94.0.682650639539.issue33690@psf.upfronthosting.co.za>
2018-05-30 04:57:25maxkinglinkissue33690 messages
2018-05-30 04:57:25maxkingcreate