curl.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:madodl 作者: miezak 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号