Using a proxy with urllib2
Rob Wolfe
rw at smsnet.pl
Fri Jan 11 13:27:33 EST 2008
"Jack" <nospam at invalid.com> writes:
> Rob,
>
> I tried your code snippet and it worked great. I'm just wondering if
> getopener( ) call
> is lightweight so I can just call it in every call to fetchurl( )? Or I
> should try to share
> the opener object among fetchurl( ) calls?
Creating an opener for every url is rather not reasonable way to go.
Sharing is the better approach. In your case you might
create e.g. two instances: simple_opener and proxy_opener.
Regards,
Rob
More information about the Python-list
mailing list