On Feb 8, 4:09 pm, "Diez B. Roggisch" <de...@nospam.web.de> wrote: > zaheer.ag...@gmail.com schrieb: > > > > > 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/a... > > 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: > > 'GEThttps://some.server.com:8181/main/folder/persons/userone/attributes/a... > > 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.</u></p><hr/ > >> <h3>Sun Java System Application Server 9.1_02</h3></body></html> > > 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
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...? -- http://mail.python.org/mailman/listinfo/python-list