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でここを検索しましたが、関連する質問は見つかりませんでした。何か間違ったことをした場合は、サイトを初めて使用します。