]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
authorNeal Norwitz <nnorwitz@gmail.com>
Tue, 24 Apr 2007 04:53:12 +0000 (04:53 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Tue, 24 Apr 2007 04:53:12 +0000 (04:53 +0000)
Doc/lib/liburllib2.tex
Lib/urllib2.py

index ed3ab96eed8e42d96a4a67a660c13278553e8036..f6ff513e647be481b55bc4a6c5a336fe05ecb352 100644 (file)
@@ -817,7 +817,10 @@ Use of Basic HTTP Authentication:
 import urllib2
 # Create an OpenerDirector with support for Basic HTTP Authentication...
 auth_handler = urllib2.HTTPBasicAuthHandler()
-auth_handler.add_password('realm', 'host', 'username', 'password')
+auth_handler.add_password(realm='PDQ Application',
+                          uri='https://mahler:8092/site-updates.py',
+                          user='klem',
+                          passwd='kadidd!ehopper')
 opener = urllib2.build_opener(auth_handler)
 # ...and install it globally so it can be used with urlopen.
 urllib2.install_opener(opener)
index 7c73f817f8131444e4e8d063e8ade103a91406e0..8a1b61bde79f1b03f11fe728159d63e5c3a6bcbc 100644 (file)
@@ -55,7 +55,10 @@ import urllib2
 
 # set up authentication info
 authinfo = urllib2.HTTPBasicAuthHandler()
-authinfo.add_password('realm', 'host', 'username', 'password')
+authinfo.add_password(realm='PDQ Application',
+                      uri='https://mahler:8092/site-updates.py',
+                      user='klem',
+                      passwd='geheim$parole')
 
 proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"})