我得到了下面的东西是我的代码片段的Python - urllib2的超时
opener = urllib2.build_opener(redirect_handler.MyHTTPRedirectHandler())
opener.addheaders = [('Accept-encoding', 'gzip')]
fetch_timeout = 12
self.response = opener.open(url, timeout=fetch_timeout)
但是,它的代码仍然等待60〜秒超时前... 任何线索?
+1,当你进来时,我正在编辑我的答案。这适用于所有版本。 – pyfunc 2010-11-17 19:09:18
似乎并不想工作。做socket.setdefaulttimeout(12)然后打印socket.getdefaulttimeout()说None这是OSX上的2.6.1 Snow Leopard – Wizzard 2010-11-18 09:07:19