data: protocol

Steven D'Aprano steve at pearwood.info
Wed May 7 23:46:27 EDT 2014


On Wed, 07 May 2014 11:42:24 +0100, Robin Becker wrote:

> I have an outstanding request for ReportLab to allow images to be opened
> using the data: scheme. That used to be supported in python 2.7 using
> urllib, but in python 3.3 urllib2 --> urllib and at least the default
> urlopener doesn't support data:


It looks like you intended to show an example, but left it out.

> Is there a way to use the residual legacy of the old urllib code that's
> now in urllib.URLopener to open unusual schemes? I know it can be used
> directly eg
> 
> urllib.request.URLopener().open('data:.........')
> 
> but that seems to leave the splitting & testing logic up to me when it
> logically belongs in some central place ie urllib.request.urlopen.

You may need to explain in a little more detail. When you say "splitting 
and testing", what are you splitting and testing? It may also help if you 
show some Python 2.7 code that works, and what happens in 3.3.


-- 
Steven



More information about the Python-list mailing list