Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time [closed]

Tags:

def check_web_server(host, port, path):
        h = httplib.HTTPConnection(host, port)
        h.request('GET',path)
        resp = h.getresponse()
        print 'HTTP Response:'
        print '   status =', resp.status
        print '   reason =', resp.reason
        print 'HTTP Headers:'
        for hdr in resp.getheaders():
                print '  %s: %s' % hdr

I called this function like this check_web_server('www.python.org',80,'/') but it gave me this error error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

You can see the code clearly here http://pastebin.com/V9KpGkvw

I have searched here in Stackoverflow but I didnt find any relevant questions sorry I am new to site ,if I Did anything wrong.

like image 531
madhu131313 Avatar asked Jan 03 '13 16:01

madhu131313


1 Answers

As ping works, but telnetto port 80 does not, the HTTP port 80 is closed on your machine. I assume that your browser's HTTP connection goes through a proxy (as browsing works, how else would you read stackoverflow?). You need to add some code to your python program, that handles the proxy, like described here:

Using an HTTP PROXY - Python

like image 94
sb9 Avatar answered Oct 07 '22 21:10

sb9