Bor*_*jaX 3 python timeout default pycurl
好吧,我认为问题的标题是非常自我解释的,所以你可能不需要继续阅读,但在这里:
我已经和PyCurl合作了一段时间,而且我总是使用它来设置我的超时
curlConnector = pycurl.Curl()
curlConnector.setopt(pycurl.CONNECTTIMEOUT, 30)
Run Code Online (Sandbox Code Playgroud)
但我已经开始想知道这是默认超时,或者如何找到它,到目前为止我还没有看到任何令人满意的答案.如果我不手动指定它,默认超时是什么?什么来自插座?(以防它是相关的,我在Ubuntu 12.04和python2.7上工作)
我下载了PyCurl.在doc/tarball 的目录中,有几个doc文件.其中之一是doc/curlobject.html,它说setup"对应libcurl中curl_easy_setopt".在该链接之后,您将访问http://curl.haxx.se/libcurl/c/curl_easy_setopt.html,在搜索"CONNECTTIMEOUT"时,它说:
CURLOPT_CONNECTTIMEOUT
Pass a long. It should contain the maximum time in seconds that you allow the connection to the server to take.
This only limits the connection phase, once it has connected, this option is of no more use.
Set to zero to switch to the default built-in connection timeout - 300 seconds.
See also the CURLOPT_TIMEOUT option.
Run Code Online (Sandbox Code Playgroud)
所以,我会说默认超时是300秒.