[Python-Dev] [RFC] urlparse - parse query facility

Fred L. Drake, Jr. fdrake at acm.org
Thu Jun 14 04:42:21 CEST 2007

On Tuesday 12 June 2007, Senthil Kumaran wrote:
 > This mail is a request for comments on changes to urlparse module. We
 > understand that urlparse returns the 'complete query' value as the query
 > component and does not
 > provide the facilities to separate the query components. User will have to
 > use the cgi module (cgi.parse_qs) to get the query parsed.

I agree with the comments Jim provided.

 > Below method implements the urlparse_qs(url,
 > keep_blank_values,strict_parsing) that will help in parsing the query
 > component of the url. It behaves same as the cgi.parse_qs.

Except that it takes a URL, not only a query string.

 > def urlparse_qs(url, keep_blank_values=0, strict_parsing=0):
 >     scheme, netloc, url, params, querystring, fragment = urlparse(url)

I see no reason to incorporate the URL splitting into the function; the 
existing function signatures for cgi.parse_qs and cgi.parse_qsl are 

It may be convenient to add methods to the urlparse.BaseResult class providing 
access to the parsed version of the query on the instance.


Fred L. Drake, Jr.   <fdrake at acm.org>

More information about the Python-Dev mailing list