Author ezio.melotti
Recipients ezio.melotti, orsenthil, sandro.tosi
Date 2011-08-07.23:46:09
SpamBayes Score 0.000354858
Marked as misclassified No
Message-id <1312760770.57.0.2285900636.issue12707@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for urllib.request.urlopen [0] says that:
"""
This function returns a file-like object [addinfourl] with two additional methods from the urllib.response module
    geturl() — return the URL of the resource retrieved, [...]
    info() — return the meta-information of the page, [...]
"""

There's also a third undocumented method: getcode().  Looking at the code[1] ISTM that the 3 getters (geturl(), info(), and getcode()):
  1) have an inconsistent interface (why not getinfo() or getheaders()?);
  2) they just return the url, headers, and code attributes;

For these two reasons I propose to:
  * document the 3 attributes as the suggested way to access this information;
  * deprecate the 3 getters;
  * avoid to document the now undocumented getcode();


[0]: http://docs.python.org/py3k/library/urllib.request.html
[1]: Lib/urllib/response.py:83
History
Date User Action Args
2011-08-07 23:46:10ezio.melottisetrecipients: + ezio.melotti, orsenthil, sandro.tosi
2011-08-07 23:46:10ezio.melottisetmessageid: <1312760770.57.0.2285900636.issue12707@psf.upfronthosting.co.za>
2011-08-07 23:46:10ezio.melottilinkissue12707 messages
2011-08-07 23:46:09ezio.melotticreate