mad*_*313 14 python http python-2.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
Run Code Online (Sandbox Code Playgroud)
我这样调用了这个函数,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搜索了这里,但我没有发现任何相关的问题抱歉我是网站的新手,如果我做错了.
sb9*_*sb9 12
正如ping
工作,但telnet
端口80
没有,HTTP端口80
在您的机器上关闭.我假设您的浏览器的HTTP连接通过代理(因为浏览有效,您还会如何阅读stackoverflow?).你需要在你的python程序中添加一些代码来处理代理,如下所述:
归档时间: |
|
查看次数: |
77492 次 |
最近记录: |