Message226736
By removing the “addinfourl” methods for HTTP responses, you are making it unnecessarily hard to handle header fields and metadata from the response. I do not know of any other documented way of getting the eventual redirect target, other than geturl(). And code to parse the Content-Type, which I understand is also returned for file: URLs, would start to get ugly (untested):
info = getattr(response, "info", None)
if info:
type = info().get_content_type() # Easy!
else:
import cgi
type = cgi.parse_header(response.getheader("Content-Type))[0]
Since a HTTP status code only seems to be returned for HTTP responses, deprecating or removing getcode() in favour of “HTTPResponse.status” might be okay, but I think info() and geturl() should stay.
Maybe a “url” attribute is more Pythonic, but as far as I am aware that has never been documented for Python 2 or 3 for any URL type. I would not expect much existing code to be using it, and deprecating geturl() seems like a needless annoyance. |
|
Date |
User |
Action |
Args |
2014-09-11 00:01:20 | martin.panter | set | recipients:
+ martin.panter, orsenthil, r.david.murray, docs@python, EvensF |
2014-09-11 00:01:20 | martin.panter | set | messageid: <1410393680.91.0.627619860838.issue21228@psf.upfronthosting.co.za> |
2014-09-11 00:01:20 | martin.panter | link | issue21228 messages |
2014-09-11 00:01:20 | martin.panter | create | |
|