Using httplib to access servlets on tomcat server

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


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 "", line 130, in <module>
  File "", line 46, in getTomcat1
    conn.request("GET", "/test/Serv1")
  File "C:\Python25\lib\", line 862, in request
    self._send_request(method, url, body, headers)
  File "C:\Python25\lib\", line 885, in _send_request
  File "C:\Python25\lib\", line 856, in endheaders
  File "C:\Python25\lib\", line 728, in _send_output
  File "C:\Python25\lib\", line 695, in send
  File "C:\Python25\lib\", line 663, in connect
socket.gaierror: (11001, 'getaddrinfo failed')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list