Fix for Issue7570: Error in urllib2 example.

This commit is contained in:
Senthil Kumaran 2009-12-24 02:18:14 +00:00
parent 3293593b54
commit f9a21f43c4
1 changed files with 2 additions and 2 deletions

View File

@ -945,10 +945,10 @@ programmatically-supplied proxy URLs, and adds proxy authorization support with
:class:`ProxyBasicAuthHandler`. :: :class:`ProxyBasicAuthHandler`. ::
proxy_handler = urllib2.ProxyHandler({'http': 'http://www.example.com:3128/'}) proxy_handler = urllib2.ProxyHandler({'http': 'http://www.example.com:3128/'})
proxy_auth_handler = urllib2.HTTPBasicAuthHandler() proxy_auth_handler = urllib2.ProxyBasicAuthHandler()
proxy_auth_handler.add_password('realm', 'host', 'username', 'password') proxy_auth_handler.add_password('realm', 'host', 'username', 'password')
opener = build_opener(proxy_handler, proxy_auth_handler) opener = urllib2.build_opener(proxy_handler, proxy_auth_handler)
# This time, rather than install the OpenerDirector, we use it directly: # This time, rather than install the OpenerDirector, we use it directly:
opener.open('http://www.example.com/login.html') opener.open('http://www.example.com/login.html')