python - How do I get urllib2 to log ALL transferred bytes -


I'm writing a web app that uses several third party web APIs, and I keep a low level track Wish requests and responses to ad-thaw analysis Therefore, I am looking for a recipe that will get urllib2 of Python to log all the bytes transferred by HTTP. Maybe a sub-classified handler?

Well, I have found out how to set up the underlying debugging library arrangement:

< Pre> import logging, urllib2, sys hh = urllib2.HTTPHandler () hsh = urllib2.HTTPSHandler () hh.set_http_debuglevel (1) hsh.set_http_debuglevel (1) opener = urllib2 .build_opener (hh, hsh) logger = logging .getLogger () logger.addHandler (logging.StreamHandler (sys.stdout)) logger.setLevel (logging.NOTSET)

But I still find a way to transfer all information Used to be.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -