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.