Python 3.0 urllib.parse.parse_qs results in TypeError

ag73 andygrove73 at
Tue Jan 13 20:54:07 CET 2009


I am trying to parse data posted to a Python class that extends
http.server.BaseHTTPRequestHandler. Here is the code I am using:

	def do_POST(self):
		ctype, pdict = cgi.parse_header(self.headers['Content-Type'])
		length = int(self.headers['Content-Length'])
		if ctype == 'application/x-www-form-urlencoded':
			qs =
			form = urllib.parse.parse_qs(qs, keep_blank_values=1)

The print statement shows the following output, so it looks like the
data is being posted correctly:


However, the last line of code that calls parse_qs causes the
following exception to be thrown:

<class 'TypeError'>
Type str doesn't support the buffer API

I haven't been able to find any information on the web about this. Any
pointers would be appreciated. I am using ActivePython 3.0 and have
tried this on Linux and Max OS X with the same outcome.



More information about the Python-list mailing list