urllib2 getting a webapage authenticating proxy...
Jeremy Hylton
jeremy at alum.mit.edu
Tue Jun 18 00:03:01 EDT 2002
Adam <a at a.com> wrote in message news:<3D0DD287.7B221A42 at a.com>...
> this code doesnt work for me... i have replaced the proxy details for
> security... can anyone help... as i havent been able find any helpfull
> websites/examples for urllib2... is urllib2 what i realy want to use for
> this...
>
> import urllib2
>
> def get_page(url):
> proxy =
> urllib2.ProxyHandler({'http':'http://userid:pass@proxy.com:port/'})
> opener = urllib2.build_opener(proxy)
> site = urllib2.urlopen(url).read()
> print(site)
>
> get_page('http://www.python.org/')
There is a SF patch that should fix this problem. See
http://sourceforge.net/tracker/index.php?func=detail&aid=527518&group_id=5470&atid=305470
If it works, you might add a comment saying that it worked for you.
I expect this will be integrated in Python CVS soon, and should get
into future bug fix releases.
Jeremy
More information about the Python-list
mailing list