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
我这样调用这个函数check_web_server('www.python.org',80,'/')
但它给了我这个错误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
你可以清楚地看到这里的代码http://pastebin.com/V9KpGkvw
我已经在这里搜查,但#1我没有找到对不起,我是新来的网站的任何相关问题,如果我做错了什么。