Martin Panter added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21228>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to