473,651 Members | 2,647 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tomcat username and password2

Still trying to get python to access my local tomcat secured with the tomcat
realm

import urllib2
handler = urllib2.HTTPBas icAuthHandler()
handler.add_pas sword(None,
'localhost:8080/manager/html', 'root', 'root')

opener = urllib2.build_o pener(handler)
urllib2.install _opener(opener)

try:
f = urllib2.urlopen ( 'http://localhost:8080/manager/html' )
except urllib2.HTTPErr or, 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 1213

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

Similar topics

6
12133
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 index.jsp file, Tomcat response with an "HTTP/1.1 302 Moved Temporarily" and a "Location: http://myhost.mydomain.com/index.jsp" ... I was wondering if there is a configuration for tomcat that can stop this behavior, i.e., just run index.jsp?
5
6460
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 created another replica DEVELOPMENT website and upgraded it to Tomcat 4.1.27. I was told this version of Tomcat supports Database Connection Pooling (DBCP) better than previous versions. I followed the instructions as listed at:...
5
37991
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
15394
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 via JSP or a servlet. I have a separate java application that I can run from the command line and as long as the user has the correct env variables:
0
1819
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: objHttpContext.Response.Status = "401 Unauthorized"; objHttpContext.Response.AddHeader ("WWW-Authenticate", "Basic realm=
2
2940
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 display below... what's wrong with my code?? please help.... thanks alot import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import java.sql.*; public class LoginServlet extends HttpServlet {
0
1538
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 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.
0
5346
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 Tomcat is rebooted. I tried to look at the access log files, and noticed this:<br> <br><br> CORRECT LOGIN<br> <br> 192.168.20.145 - - "GET / HTTP/1.1" 200
0
1351
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. So I tried it with ant and I 've following relevant entrys in the build.xml file : <project name="My Project" default="compile" basedir=".">
0
8347
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8694
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8457
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8571
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.