What is the maximum debuglevel level for Python httplib

These documents do not say what the maximum debugging level is.

I need to know that.

+7
source share
2 answers

I went through httplib.py and the code is littered with the following expression:

if self.debuglevel > 0: 

This means that there are only two levels.

  • debuglevel is less than or equal to zero
  • debuglevel is greater than zero

Yes, it could be better documented.

Also, at any time when you need to check such information, you can easily view the code. Here is my favorite approach to locate a source file for a particular module.

 >>> import httplib >>> httplib.__file__ '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc' 

Now you can simply open the following file to view its source code.

 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py 
+10
source

As I saw from httplib.py sources, there are only two levels of debugging:

  • <= 0 - no debugging information
  • any value greater than zero - enable debugging information

This is a typical check:

 if self.debuglevel > 0: print "blablabla" 
+2
source

All Articles