2013-02-07 94 views
2

嗯,我認爲這個問題的標題是非常自我解釋,所以你可能不需要繼續閱讀,但這裏有雲:什麼是PyCurl默認的超時

我一直在PyCurl工作了同時,我一直使用設置

curlConnector = pycurl.Curl() 
curlConnector.setopt(pycurl.CONNECTTIMEOUT, 30) 

我超時,但我已經開始想這是默認的超時,或者如何找到它,我還沒有看到任何滿意的答覆爲止。如果我不沒有手動指定它,默認超時是什麼?無論來自socket? (爲了以防萬一,我使用Ubuntu 12.04和python2.7)

回答

3

我下載了PyCurl。在tarball的doc/目錄中,有幾個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. 

所以,我想說的默認超時時間爲300秒。