开发者

Silencing libcurl/pycurl PUT and POST

开发者 https://www.devze.com 2023-01-11 08:42 出处:网络
I have a python script which does a bunch of PUTs and POSTs, and when they are successful curl will output the updated html to stdout. I was wondering if there was a way to keep it from doing this? I

I have a python script which does a bunch of PUTs and POSTs, and when they are successful curl will output the updated html to stdout. I was wondering if there was a way to keep it from doing this? I don't really care about this information, so 开发者_高级运维sending it to a file isn't necessary, but that seems to be the only solution I can find.


Try setting the WRITEFUNCTION option in the Curl object.

from StringIO import StringIO
body = StringIO()
(...)
c.setopt(c.WRITEFUNCTION, body.write)

Full example can be seen in curl CVS repository.

0

精彩评论

暂无评论...
验证码 换一张
取 消