Using httplib to access servlets on tomcat server

Marco Bizzarri marco.bizzarri at gmail.com
Wed Sep 3 05:28:10 EDT 2008


On Wed, Sep 3, 2008 at 11:06 AM, jorma kala <jjkk73 at gmail.com> 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/



More information about the Python-list mailing list