Using httplib to access servlets on tomcat server

2008-09-03 Thread jorma kala
Hi,

I'm trying unsuccesfully to use the httplib library to execute servlets on a
local tomcat server.

If I type the following http adress on my browser
http://localhost:8080/test/Serv1  the servlet works fine.
But if I try to access it with the following python code:

   conn = httplib.HTTPConnection(http://localhost:8080;)
   conn.request(GET, /test/Serv1)
   r1 = conn.getresponse()

I get the following error:

socket.gaierror: (11001, 'getaddrinfo failed')

Do you know what I do wrong?
Thank you very much.


(The complete traceback is:

Traceback (most recent call last):
  File http1.py, line 130, in module
getTomcat1()
  File http1.py, line 46, in getTomcat1
conn.request(GET, /test/Serv1)
  File C:\Python25\lib\httplib.py, line 862, in request
self._send_request(method, url, body, headers)
  File C:\Python25\lib\httplib.py, line 885, in _send_request
self.endheaders()
  File C:\Python25\lib\httplib.py, line 856, in endheaders
self._send_output()
  File C:\Python25\lib\httplib.py, line 728, in _send_output
self.send(msg)
  File C:\Python25\lib\httplib.py, line 695, in send
self.connect()
  File C:\Python25\lib\httplib.py, line 663, in connect
socket.SOCK_STREAM):
socket.gaierror: (11001, 'getaddrinfo failed')
--
http://mail.python.org/mailman/listinfo/python-list

Re: Using httplib to access servlets on tomcat server

2008-09-03 Thread Marco Bizzarri
On Wed, Sep 3, 2008 at 11:06 AM, jorma kala [EMAIL PROTECTED] wrote:
 Hi,

 I'm trying unsuccesfully to use the httplib library to execute servlets on a
 local tomcat server.

 If I type the following http adress on my browser
 http://localhost:8080/test/Serv1  the servlet works fine.
 But if I try to access it with the following python code:

conn = httplib.HTTPConnection(http://localhost:8080;)
conn.request(GET, /test/Serv1)
r1 = conn.getresponse()

 I get the following error:

 socket.gaierror: (11001, 'getaddrinfo failed')

 Do you know what I do wrong?
 Thank you very much.




localhost is not resolved to 127.0.0.1 on your machine.

Try changing it to http://127.0.0.1:8080

Regards
Marco


-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
--
http://mail.python.org/mailman/listinfo/python-list