Using httplib to access servlets on tomcat server

jorma kala jjkk73 at gmail.com
Wed Sep 3 11:06:38 CEST 2008


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')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080903/f95f0324/attachment.html>


More information about the Python-list mailing list