[New-bugs-announce] [issue12707] Deprecate addinfourl getters

Ezio Melotti report at bugs.python.org
Mon Aug 8 01:46:10 CEST 2011

New submission from Ezio Melotti <ezio.melotti at gmail.com>:

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

components: Library (Lib)
keywords: easy
messages: 141756
nosy: ezio.melotti, orsenthil, sandro.tosi
priority: normal
severity: normal
stage: needs patch
status: open
title: Deprecate addinfourl getters
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list