This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年06月23日 03:02 by someone3x7, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg138850 - (view) | Author: Joesph (someone3x7) | Date: 2011年06月23日 03:02 | |
"""
Per the documentation urlencode is supposed to encode a structure returned by parse_qs back to a query string. However, urlencode appears to not be processing the lists associated with each key.
Example:
"""
import urllib.parse
dictQuery = urllib.parse.parse_qs('a=b&b=c&c=d&c=e',
strict_parsing=True,
encoding='iso8859-1')
assert isinstance(dictQuery,dict)
assert isinstance(dictQuery['a'],list)
strQuery = urllib.parse.urlencode(dictQuery, encoding='iso8859-1')
print(strQuery)
"""
Outputs: a=%5B%27b%27%5D&c=%5B%27d%27%2C+%27e%27%5D&b=%5B%27c%27%5D
Which means: a=['b']&c=['d', 'e']&b=['c']
Expected: a=b&c=d&c=e&b=c
"""
|
|||
| msg138851 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2011年06月23日 03:41 | |
I see you missed the doseq parameter which is applicable in this case. print(urllib.parse.urlencode(dictQuery, encoding='iso8859-1',doseq=True)) a=b&c=d&c=e&b=c |
|||
| msg138856 - (view) | Author: Joesph (someone3x7) | Date: 2011年06月23日 07:25 | |
Hrm, yes. 'Tis what I get for working while sick. |
|||
| msg138857 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2011年06月23日 07:30 | |
Joseph, resolution applies for the bug not the process. tc. :) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:18 | admin | set | github: 56599 |
| 2011年06月23日 07:30:20 | orsenthil | set | resolution: accepted -> not a bug messages: + msg138857 |
| 2011年06月23日 07:25:24 | someone3x7 | set | resolution: not a bug -> accepted messages: + msg138856 |
| 2011年06月23日 03:41:41 | orsenthil | set | status: open -> closed nosy: + orsenthil messages: + msg138851 resolution: not a bug |
| 2011年06月23日 03:02:45 | someone3x7 | create | |