[Python-Dev] urllib vs. cgi

Jeremy Hylton jeremy@beopen.com
Thu, 13 Jul 2000 22:28:10 -0400 (EDT)

I was doing a little Web programming this evening and discovered an
annoying asymmetry.  The urllib module has a urlencode function that
translates a dictionary of form entries into a URL query string.  I
wanted the inverse "urldecode" that turns the query string into the
dictionary.  There isn't one.

But I guessed that CGI programmers had to have a function to do this!
It seems there is one called cgi.parse_qs.  This wasn't an obvious
place to look, because I wasn't doing CGI programming at all.  (I was
writing a screen-scraped for SourceForge.)

Any opinions on adding a symmetrical urldecode to urllib?  I'm not
thrilled by duplicating code, but the cgi module is big and hairy and
urllib seems like the obvious place for it.