Errno 10060]连接尝试失败,因为经过一段时间后被连接方未正确响应
这个问题不太可能对将来的访客有所帮助;它仅与较小的地理区域,特定的时间段或极为狭窄的情况相关,通常不适用于Internet的全球受众。要获得使该问题更广泛适用的帮助,请访问帮助中心。
7年前关闭。
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清楚看到代码
我在Stackoverflow的此处进行过搜索,但没有找到任何相关问题,对不起,如果我做错了什么,我还是新手。
-
至于
ping
作品,但telnet
端口80
没有,HTTP端口80
是关闭你的机器上。我假设您的浏览器的HTTP连接通过一个代理(随着浏览的进行,您还将如何阅读stackoverflow?)。您需要在python程序中添加一些处理代理的代码,如下所示: