StvOR!

March 19, 2008

Debugging Python HTTPConection recipe

Filed under: All, Linux, Python

Nice built in way to debug http connections problems in your python code.

This is nothing new, just for my reference, so I don’t have to hunt it down every time I need it.

   import httplib
   import urllib2

   # For urllib it's enough to do
   # httplib.HTTPConnection.debuglevel = 1
   #
   # but for urllib2 we have to:
   handler =  urllib2.HTTPHandler(debuglevel=1)
   opener = urllib2.build_opener(handler)
   urllib2.install_opener(opener)

Sources: python docs, Jamie Grove, python mailing list

Comments »

The URI to TrackBack this entry is: http://stvor.blogsome.com/2008/03/19/debugging-python-httpconection-recipe/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome | Theme designs available here