[New-bugs-announce] [issue19917] [httplib] logging information for request is not pretty printed

Matej Cepl report at bugs.python.org
Sat Dec 7 11:44:40 CET 2013


New submission from Matej Cepl:

looking at
http://hg.python.org/cpython/file/543c76769c14/Lib/http/client.py#l847
(logging in HTTPConnection.send method; but this code has been same since like forever) I see that the HTTP request is NOT pretty printed:

     if self.debuglevel > 0:
         print("send:", repr(data))

whereas response in effect (because every header is printed separately) is. Wouldn't it be better to pretty print the request as well?

Otherwise I get quite unreadable debugging logs like the following (notice how much response is more readable than request).

It seems to me that proper solution could be just to replace repr() here with something more readable. Wouldn't just str() help? Barring that we can go all the way to pprint.pformat().

----------
components: Library (Lib)
files: urllib2-kerberos-log.txt
messages: 205446
nosy: mcepl
priority: normal
severity: normal
status: open
title: [httplib] logging information for request is not pretty printed
Added file: http://bugs.python.org/file33021/urllib2-kerberos-log.txt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19917>
_______________________________________


More information about the New-bugs-announce mailing list