This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mingus
Recipients docs@python, mingus
Date 2013-09-03.17:30:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The python documentation links to an outside website for info and examples on http basic auth. This documentation is terrible and confusing. The link should be removed, and user's should be advised to use the Requests library.

# this example is from
# which is linked to by the official python docs

import urllib2
theurl = ''
username = 'johnny'
password = 'XXXXXX'
# a great password
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
# this creates a password manager
passman.add_password(None, theurl, username, password)
# because we have put None at the start it will always
# use this username/password combination for  urls
# for which `theurl` is a super-url
authhandler = urllib2.HTTPBasicAuthHandler(passman)
# create the AuthHandler
opener = urllib2.build_opener(authhandler)
# All calls to urllib2.urlopen will now use our handler
# Make sure not to include the protocol in with the URL, or
# HTTPPasswordMgrWithDefaultRealm will be very confused.
# You must (of course) use it when fetching the page though.
pagehandle = urllib2.urlopen(theurl)
# authentication is now handled automatically for us
Date User Action Args
2013-09-03 17:30:20mingussetrecipients: + mingus, docs@python
2013-09-03 17:30:20mingussetmessageid: <>
2013-09-03 17:30:20minguslinkissue18914 messages
2013-09-03 17:30:20minguscreate