[Python-ideas] Support data: URLs in urllib

Paul Moore p.f.moore at gmail.com
Sat Nov 3 11:40:30 CET 2012


On 2 November 2012 23:47, Mathias Panzenböck
<grosser.meister.morti at gmx.net> wrote:
> Which version do you think is the best for the recipe? I guess losing the
> mediatype (and thus the charset) is not so good, therefore the version with
> the DataResponse is better? Maybe with a note that if you don't need the
> mediatype you can simply return an io.BytesIO as well? How does one submit a
> doc patch anyway? Is there a hg repo for the documentation and a web
> interface through which one can submit a pull request?

You should probably be consistent with urllib's behaviour for other
URLs - from the documentation of urlopen:

"""
This function returns a file-like object that works as a context
manager, with two additional methods from the urllib.response module

geturl() — return the URL of the resource retrieved, commonly used to
determine if a redirect was followed
info() — return the meta-information of the page, such as headers, in
the form of an email.message_from_string() instance (see Quick
Reference to HTTP Headers)
Raises URLError on errors.
"""

To create a doc patch, open a feature request on bugs.python.org and
attach a patch. The documentation is in the core Python repository,
from hg.python.org. You can clone that and use Mercurial to generate a
patch, but there's no "pull request" mechanism that I know of.

Paul



More information about the Python-ideas mailing list