This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib2 dont respect debuglevel in httplib
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: abbatini, jjlee
Priority: normal Keywords:

Created on 2005-02-27 02:49 by abbatini, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg24372 - (view) Author: abbatini (abbatini) Date: 2005-02-27 02:49
It is common habit to see http headers:

>>> import httplib
>>> httplib.HTTPConnection.debuglevel = 1
>>> import urllib
>>> feeddata =
urllib.urlopen('http://diveintomark.org/xml/atom.xml').read()

but this dont work with import urllib2 with python 2.4
In rev 1.57 was intoduced code to AbstractHTTPHandler class
that prevent above mentioned construction.
Init method always set debuglevel=0 then do_open method
always do:

h.set_debuglevel(self._debuglevel)

after instantiating HTTPConnection class.

Regards
msg24373 - (view) Author: abbatini (abbatini) Date: 2005-02-27 02:57
Logged In: YES 
user_id=1227778

of course:

# h.set_debuglevel(self._debuglevel)

work very well, but i dont know reason
this code was introduced,
maybe forgotten code since development
msg24374 - (view) Author: John J Lee (jjlee) Date: 2005-05-19 19:40
Logged In: YES 
user_id=261020

The .set_debuglevel() method allows debugging
per-HTTPConnection when using urllib2 (instead of turning on
debug prints for *all* HTTPConnection instances).

Since this is just turns on some debug prints, I don't see
any great need to contort the code and/or confuse people
further by attempting to "fix" this.
msg24375 - (view) Author: John J Lee (jjlee) Date: 2006-02-01 20:34
Logged In: YES 
user_id=261020

Can somebody close this?
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41624
2005-02-27 02:49:07abbatinicreate