urllib proxy support confusion

Mark Dickinson dickinsm at gmail.com
Tue Mar 11 16:16:58 EDT 2008


On Mar 11, 12:26 pm, Grant Edwards <gra... at visi.com> wrote:
> Before I submit a bug, I'll give it a try to find out if it
> does support explicit specification of proxys or not.

Sounds good.  If it does, then I think the whole paragraph
(from "The urlopeen() function does not support explicit proxy
..." to "...subclass such as FancyURLopener.") should just be
removed.

Looking at the source, there are some slight oddities: a plain
urlopen() caches the URLopener instance it creates (in a module-level
global) and uses this cached instance in future calls to urlopen
or urlretrieve.  If proxies are specified then it doesn't do the
caching.  I don't *think* this really affects usage, except that
there are presumably some inefficiencies involved in multiple uses
of urlopen with explicitly specified proxies, and those inefficiencies
can be overcome by using URLopener or FancyURLopener directly instead.

And it doesn't make a lot of sense that urlopen accepts proxies, but
urlretrieve does not.  But that's a different issue...

Mark



More information about the Python-list mailing list