summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-04-24 04:54:24 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2007-04-24 04:54:24 +0000
commit112717dd0b08797c49205313164c8ee08965ec8c (patch)
tree45664767963d0df55fee760217cef527ca20b10a
parent6def78ae859903ce90f657d27728312f3f7daf2b (diff)
downloadcpython-git-112717dd0b08797c49205313164c8ee08965ec8c.tar.gz
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
-rw-r--r--Doc/lib/liburllib2.tex5
-rw-r--r--Lib/urllib2.py5
2 files changed, 8 insertions, 2 deletions
diff --git a/Doc/lib/liburllib2.tex b/Doc/lib/liburllib2.tex
index 542a7b8eab..b98e5db3e1 100644
--- a/Doc/lib/liburllib2.tex
+++ b/Doc/lib/liburllib2.tex
@@ -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)
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 4e926a154b..007e905e75 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -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"})