[Tutor] Requesting restricted URL (further authentication requested)

Tim Johnson tim at johnsons-web.com
Tue Oct 19 21:56:06 CEST 2010


I've written the following function which successfully gets an
authenticated URL:
def getRestrictedURL(authName,URL,log,pswd):
	auth_handler = urllib2.HTTPBasicAuthHandler()
	auth_handler.add_password(authName, URL,log,pswd)
	opener = urllib2.build_opener(auth_handler)
	urllib2.install_opener(opener)
	return opener.open(URL).read()
# But, alas, any links in content 'beneath' the URL
# require additional authentication. 
Any way around this?
Thanks
-- 
Tim 
tim at johnsons-web.com or akwebsoft.com
http://www.akwebsoft.com


More information about the Tutor mailing list