logging outgoing HTTP POST message and incoming response message

Diez B. Roggisch deets at nospam.web.de
Wed Jul 22 16:54:02 EDT 2009

scriptlearner at gmail.com schrieb:
> 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?

You can use proxy-tools such as tcpmon or sniff traffic using wireshark.


More information about the Python-list mailing list