Internal Server error

Z

zaheer.agadi

HI
I am getting an internal server error while trying get response from a
server following is my code


def getDetails(self,username,password):
urllib = urllib2.Request
idurl="https://some.server.com/"
port=8181
conn = httplib.HTTPSConnection("some.server.com/",8181);
conn.debuglevel = 1
username = "userone"
password = "aaaa"
Auth = "Basic" + ecnodeURL(self,username, password)
url= "https://some.network.com:8181/main/folder/persons/" +
username + "/attributes/atrone"
print url
headers = {"Authorization": Auth,"Accept": "application/json"}
conn.request("GET", url,{},headers)
response = conn.getresponse()
data = response.read()
print response.reason
print response.


What I am getting as response

https://some.server.com:8181/main/folder/persons/userone/attributes/atrone
C:\Python26\lib\site-packages\httplib2\__init__.py:29:
DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
C:\Python26\lib\site-packages\httplib2\__init__.py:44:
DeprecationWarning: the sha module is deprecated; use the hashlib
module instead
import sha
send: 'GET https://some.server.com:8181/main/folder/persons/userone/attributes/atrone
HTTP/1.1\r\nHost: /some.server.com:8181\r\nAccept-Encoding: identity\r
\nAccept: application/json\r\nAuthorization: BasicU3RvcmFnZUVncjA1OA==
\r\n\r\n'
reply: 'HTTP/1.1 500 Internal Server Error\r\n'
header: Content-Type: text/html
header: Content-Language:
header: Content-Length: 1299
header: Date: Sun, 08 Feb 2009 10:25:52 GMT
header: Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Sun
Java System Application Server 9.1_02 - Error report</title><style
type="text/css"><!--H1 {font-family:Tahoma,Arial,sans-
serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-
family:Tahoma,Arial,sans-serif;color:white;background-
color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-
serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-
family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-
color:#525D76;} P {font-family:Tahoma,Arial,sans-
serif;background:white;color:black;font-size:12px;}A {color : black;}
HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </
h1><hr/><p><b>type</b> Exception report</p><p><b>message</b></
p><p><b>description</b>The server encountered an internal error ()
that prevented it from fulfilling this request.</p><p><b>exception</b>
<pre>java.util.NoSuchElementException</pre></p><p><b>note</b> <u>The
full stack traces of the exception and its root causes are available
in the Sun Java System Application Server 9.1_02 logs. said:
<h3>Sun Java System Application Server 9.1_02</h3></body></html>
Internal Server Error
<httplib.HTTPResponse instance at 0x00B9CDA0>


Thanks alot
 
D

Diez B. Roggisch

HI
I am getting an internal server error while trying get response from a
server following is my code


def getDetails(self,username,password):
urllib = urllib2.Request
idurl="https://some.server.com/"
port=8181
conn = httplib.HTTPSConnection("some.server.com/",8181);
conn.debuglevel = 1
username = "userone"
password = "aaaa"
Auth = "Basic" + ecnodeURL(self,username, password)
url= "https://some.network.com:8181/main/folder/persons/" +
username + "/attributes/atrone"
print url
headers = {"Authorization": Auth,"Accept": "application/json"}
conn.request("GET", url,{},headers)
response = conn.getresponse()
data = response.read()
print response.reason
print response.


What I am getting as response

https://some.server.com:8181/main/folder/persons/userone/attributes/atrone
C:\Python26\lib\site-packages\httplib2\__init__.py:29:
DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
C:\Python26\lib\site-packages\httplib2\__init__.py:44:
DeprecationWarning: the sha module is deprecated; use the hashlib
module instead
import sha
send: 'GET https://some.server.com:8181/main/folder/persons/userone/attributes/atrone
HTTP/1.1\r\nHost: /some.server.com:8181\r\nAccept-Encoding: identity\r
\nAccept: application/json\r\nAuthorization: BasicU3RvcmFnZUVncjA1OA==
\r\n\r\n'
reply: 'HTTP/1.1 500 Internal Server Error\r\n'
header: Content-Type: text/html
header: Content-Language:
header: Content-Length: 1299
header: Date: Sun, 08 Feb 2009 10:25:52 GMT
header: Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Sun
Java System Application Server 9.1_02 - Error report</title><style
type="text/css"><!--H1 {font-family:Tahoma,Arial,sans-
serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-
family:Tahoma,Arial,sans-serif;color:white;background-
color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-
serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-
family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-
color:#525D76;} P {font-family:Tahoma,Arial,sans-
serif;background:white;color:black;font-size:12px;}A {color : black;}
HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </
h1><hr/><p><b>type</b> Exception report</p><p><b>message</b></
p><p><b>description</b>The server encountered an internal error ()
that prevented it from fulfilling this request.</p><p><b>exception</b>
<pre>java.util.NoSuchElementException</pre></p><p><b>note</b> <u>The
full stack traces of the exception and its root causes are available

Internal Server Error
<httplib.HTTPResponse instance at 0x00B9CDA0>

What do you expect us to do about this? That has nothing todo with
python, what you do is that you don't speak the right way with the
server in question, producing a stacktrace. But nobody here knows *how*
to talk to that machine. O

Diez
 
Z

zaheer.agadi

(e-mail address removed) schrieb:







What do you expect us to do about this? That has nothing todo with
python, what you do is that you don't speak the right way with the
server in question, producing a stacktrace. But nobody here knows *how*
to talk to that machine. O

Diez

Thanks,

I know there is something on the wrong side, when it says
java.util.NoSuchElementException i thought something wrong with
setting values I just wanted you guys to point me out there is
something wrong with the code I have written I am not very familiar
with Python the same work for java works fine.

I wanted to know if I am setting the headers correctly, getting the
response correctly
are there any better ways of encoding the url Over all Does the code
look ok...?
 
D

Diez B. Roggisch

Thanks,

I know there is something on the wrong side, when it says
java.util.NoSuchElementException i thought something wrong with
setting values I just wanted you guys to point me out there is
something wrong with the code I have written I am not very familiar
with Python the same work for java works fine.

Well, it's obviously not the same. Otherwise it *would* work fine as well.

your code is a bit non-idiomatic:

urllib = urllib2.Request

is *very* misleading, aliasing a class-constructor with a well-known
modulename.

Not using username & password also isn't really making sense.

"ecnodeURL" - what is that? Where does that come from - certainly not from
the stdlib, that's got a better spelling correction.

Instead of

"string" + variable + "string"

on usually uses string interpolation to build complicated strings:

"some text %s some more text" % variable


I wanted to know if I am setting the headers correctly, getting the
response correctly
are there any better ways of encoding the url Over all Does the code
look ok...?

You seem to make the call correctly. Just not what the server expects.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top