Message226736
| Author |
martin.panter |
| Recipients |
EvensF, docs@python, martin.panter, orsenthil, r.david.murray |
| Date |
2014年09月11日.00:01:20 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1410393680.91.0.627619860838.issue21228@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|