当pycurl执行其perform()方法时, Python脚本是否等待它执行(WRITEFUNCTION)或python 即使没有输入WRITEFUNCTION或没有返回结果,也会立即进入下一行? E.g。
curl.setopt(pycurl.WRITEFUNCTION, receive)
curl.perform()
some_call() # is this line immeditely executed? can I expect receive() has already exited?
答案 0 :(得分:1)
pycurl是C实现(libcurl)的包装器,C实现在执行curl_easy_perform
或curl_multi_perform
函数期间调用其WRITEFUNCTION回调函数(相当于pycurl {{1} })。
所以你可以期待你的回调在perform
返回之前完成执行。即 perform
完成后,您可以期待{em}