example_utils.py 文件源码

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

项目:elm 作者: ContinuumIO 项目源码 文件源码
def get_request(url, outfpath=None):
    global PYCURL
    if PYCURL:
        # outfpath must be set
        import pycurl
        from io import BytesIO
        buffer = BytesIO()
        c = pycurl.Curl()
        c.setopt(c.URL, url)
        c.setopt(c.WRITEDATA, buffer)
        c.setopt(c.COOKIEJAR, '/tmp/cookie.jar')
        c.setopt(c.NETRC, True)
        c.setopt(c.FOLLOWLOCATION, True)
        #c.setopt(c.REMOTE_NAME, outfpath)
        c.perform()
        c.close()
        return buffer.getvalue()
    resp = requests.get(url)
    return resp.text
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号