create_manifest.py 文件源码

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

项目:dinobuildr 作者: mozilla 项目源码 文件源码
def pointer_to_json(dl_url):
    content_req = urllib2.Request(dl_url)
    content_result = urllib2.urlopen(content_req)
    output = content_result.read()
    content_result.close()
    oid = (re.search('(?m)^oid sha256:([a-z0-9]+)$', output)).group(1)
    size = (re.search('(?m)^size ([0-9]+)$', output)).group(1)
    json_data = (
        '{"operation": "download", '
        '"transfers": ["basic"], '
        '"objects": [{"oid": "%s", "size": %s}]}' % (oid, size))

    return json_data


# the get_lfs_url function makes a request the the lfs API of the github repo,
# receives a JSON response then gets the download URL from the JSON response
# and returns it.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号