Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum debuglevel for a Python httplib

Tags:

python

httplib

These docs do not say what the maximum debug level is.

I need to know that.

like image 744
Terrence Brannon Avatar asked Jul 06 '12 21:07

Terrence Brannon


2 Answers

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

if self.debuglevel > 0:

This means there are just two levels.

  1. debuglevel less than or equal to zero
  2. debuglevel greater than zero

Yes this could have been better documented.

Also any time you need to check such an information, you can easily look at 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 just open the following file to go through it's source code

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py
like image 175
pyfunc Avatar answered Sep 22 '22 02:09

pyfunc


As I saw from httplib.py sources there are only 2 debug levels:

  • <=0 - no debug info
  • any value greater than zero - turn on debug info

This is a typical check:

if self.debuglevel > 0:
        print "blablabla"
like image 37
Maksym Polshcha Avatar answered Sep 21 '22 02:09

Maksym Polshcha