473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Tomcat username and password2

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.

Jan 14 '06 #1
0 1206

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: DaiIchi | last post by:
I'm using Tomcat in standalone mode. When a URL without a filename is entered into the browser (ie. "http://myhost.mydomain.com"), and the default path does NOT have an index.html, but rather an...
5
by: Tom Martin | last post by:
I'm a Java Web developer NEWBIE that has inherited a website that fails every 2 hours due to poor connection pooling between Tomcat 4.0.6 and mySQL. In efforts to resolve this problem, I've...
5
by: D E | last post by:
When using my web application manager (http://localhost:8080/admin) I forgot my password. Is there an XML file i can look at to remember/obtain (possibly even set). Thanks
3
by: Andrew Johnson | last post by:
Hi, I am trying to make a UBD DB2 7.2 connection using the Java COM.ibm.db2.jdbc.app.DB2Driver via Tomcat 3.2.1 on Solaris (and also on an AIX system with 3.3.1). I am attempting this either...
0
by: AlexTengco | last post by:
Hi All, I'm not sure if this is the right group to ask this question, but I'll give it a try. I'm currently developing a dotnet web app. Using custom authentication like this: ...
2
by: serene | last post by:
i create a html login page.. so after i click login, the tomcat appear a error sentence which says something like java.sql.SQLExcepton etc Syntax error in FROM clause.... the folowing java code are...
0
by: Michael Oliver | last post by:
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...
0
by: Elvandar | last post by:
<p> Hi all. I've a web application running under tomcat 5.0.28. Sometimes, after a couple of days of 24h running of the server, suddenly it becames impossibile to log in the application, until...
0
by: androusm | last post by:
Hi all, I have a problem with reload my servlet with tomcat 5.0.27 My servlet is the one example of the struts "struts-example". I also make changes and want to reload it by tomcat 5.0.27. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.