Still trying to get python to access my local tomcat secured with the tomcat realm
import urllib2 handler = urllib2.HTTPBasicAuthHandler() handler.add_password(None, 'localhost:8080/manager/html', 'root', 'root') opener = urllib2.build_opener(handler) urllib2.install_opener(opener) try: f = urllib2.urlopen( 'http://localhost:8080/manager/html' ) except urllib2.HTTPError, e: if e.code == 401: print 'not authorized' elif e.code == 404: print 'not found' elif e.code == 503: print 'service unavailable' else: print 'unknown error: ' else: print 'success' for line in f: print line, [Mike Oliver>>] this returns 'not authorized' no matter what I put in for 'realm' or 'host' to the add_password() method. I have tried None, 'tomcat' for realm and 'localhost' and about every combination I can think of for 'host' if I go to that URL with a browser it asks for username and password as above and that works. I can access it with code from PHP or Java just fine. -- http://mail.python.org/mailman/listinfo/python-list