def curl_to_buf(url, proto, c=None, buf=None):
if ((c and buf is None) or
(buf and c is None)):
_out.die('bad arguments!')
if c is None:
buf = BytesIO()
c = curl_common_init(buf)
c.setopt(c.URL, url)
try:
c.perform()
except pycurl.error:
check_curl_error(c, buf, proto, True)
check_curl_error(c, buf, proto)
c.close()
return buf
评论列表
文章目录