data: protocol

Ian Kelly ian.g.kelly at gmail.com
Thu May 8 11:07:25 EDT 2014


On Thu, May 8, 2014 at 4:34 AM, Robin Becker <robin at reportlab.com> wrote:
> Since urllib doesn't always work as expected in 3.3 I've had to write a
> small stub for the special data: case. Doing all the splitting off of the
> headers seems harder than just doing the special case.
>
> However, there are a lot of these 'schemes' so should I be doing this sort
> of thing? Apparently it's taken 4 versions of python to get urllib in 3.4 to
> do this so it's not clear to me whether all schemes are supposed to hang off
> urllib.request.urlopen or if instead of special casing the 3.3 data: I
> should have special cased a handler for it and injected that into my opener
> (or possibly the default opener). Doing the handler means I do have to
> handle the headers stuff whereas my stub is just returning the data bits.

The DataHandler class in 3.4 is all of 14 lines of code. My first
instinct would be to backport that and add it to some OpenerDirector
instance.



More information about the Python-list mailing list