httplib or urllib2 tomcat username and password

Michael Oliver ollie at
Fri Jan 13 18:01:55 EST 2006

I am trying to write a Python client to access a Tomcat servlet using Tomcat
Realm authentication with no success.


I can use the httplib to connect to localhost port 8080 ok and post and get
and all that is fine, but when I try to set username and password and access
a protected part of tomcat it fails with an Unauthorized.


Does anyone have an example of connecting to Tomcat using the Tomcat Realm
(.i.e. tomcat-users.xml) authentication?

I have also tried urllib2 and the example in the header comments still gives
me a HTTP Error 401: Unauthorized when I try to open



	 Highly Cohesive and Loosely Coupled	
Mike Oliver
CTO 	Alarius Systems LLC
6800 E. Lake Mead Blvd
Apt 1096
Las Vegas, NV 89156 	
ollie at 	tel: 
mobile: 	(702)953-8949 
Add me to your address book...	 Want a signature like this?	

More information about the Python-list mailing list