[issue21228] Missing enumeration of HTTPResponse Objects methods of urllib.request.urlopen's http.client.HTTPResponse?

Martin Panter report at bugs.python.org
Tue Apr 22 05:31:54 CEST 2014


Martin Panter added the comment:

I interpreted it more along the lines of “. . . returns a http.client.HTTPResponse object [with] the following [additional] methods.” Indeed, a HTTP urlopen() response I just tried does have info(), geturl() and getcode() methods, and I know the info() method is used in the real world.

Also, it would be good to document that the HTTP response’s “msg” attribute does not actually hold the header, despite the HTTPResponse documentation. Further, the return value of BaseHandler.default_open() is defined to be the same as urlopen(), but when a HTTP error occurs I have found the “msg” attribute is meant to be the HTTP status text phrase (e.g. “Not Found”).

Perhaps it would be good to add something like these two points wherever they belong:

* The “msg” attribute returned by urlopen() does not hold the HTTP header, despite the “HTTPResponse” documentation
* The “msg” attribute should be set to the HTTP status text phrase (HTTPResponse.reason)

----------
nosy: +vadmium

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


More information about the Python-bugs-list mailing list