classification
Title: Providing a custom HTTPResponse class to HTTPConnection
Type: enhancement Stage: patch review
Components: Documentation Versions: Python 3.6, Python 3.5, Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: BreamoreBoy, angad, berker.peksag, docs@python, martin.panter, orsenthil, r.david.murray
Priority: normal Keywords: patch

Created on 2011-11-22 19:02 by r.david.murray, last changed 2015-07-07 01:01 by martin.panter.

Files
File name Uploaded Description Edit
response_class.http.client.patch angad, 2015-07-04 07:23 review
Messages (4)
msg148136 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-11-22 19:02
The doc string for HTTPConnection.getresponse mentions (in broken English) that the instance's response_class attribute determines what class gets instantiated for a response.  The docs do not mention this attribute, nor any other way to control what class is used.

Since this attribute already exists and is mentioned in the doc string, can we consider this a doc error and just document it?
msg221807 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-28 18:21
ping.
msg246241 - (view) Author: Angad Singh (angad) * Date: 2015-07-04 07:23
I have a patch for this. I have also documented some of the non-documented attributes of HTTPConnection class.
msg246388 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-07-07 01:01
Why do people want “response_class” to be part of the API? If so, more details about it may need to added, e.g. the following methods and attributes seem to be required: _read_status(), fp, close(), isclosed(), begin() and will_close.

The “debuglevel” attribute seems fairly redundant with the existing set_debuglevel() method.

Also, what is the point of adding the “default_port” attribute, if it cannot be modified? The only use case I can imagine is in a subclass that specifically does modify it. But I’m not sure it should be added at all.

So I am sorry, but I don’t see why any of the three additions in the patch should be made. IMO it would be better to explain that “response_class” is an internal implementation detail, or even drop it entirely from the doc string.
History
Date User Action Args
2015-07-07 01:01:38martin.pantersetnosy: + martin.panter
messages: + msg246388
2015-07-04 10:32:39berker.peksagsetnosy: + berker.peksag
stage: patch review
type: enhancement

versions: + Python 3.4, Python 3.5, Python 3.6, - Python 3.2, Python 3.3
2015-07-04 07:23:02angadsetfiles: + response_class.http.client.patch

nosy: + angad
messages: + msg246241

keywords: + patch
2014-06-28 18:21:36BreamoreBoysetnosy: + BreamoreBoy
messages: + msg221807
2011-11-22 19:02:13r.david.murraycreate