logging outgoing HTTP POST message and incoming response message

scriptlearner at gmail.com scriptlearner at gmail.com
Wed Jul 22 16:51:18 EDT 2009


I am sending a HTTP POST by using the following codes:

opener = urllib2.build_opener(proxyHandler, MultipartPostHandler)
params = { "audio" : "http://sample.com/my.wav",
"data" : open(file, "rb") }
print opener.open(myURL, params).read()

How do I log or print out the actual POST message (including headers)
that is sent out?
How do I log or print out the response headers as well?

Thanks



More information about the Python-list mailing list