def main(argv):
parser = build_cli_parser()
opts, args = parser.parse_args(argv)
if not opts.url or not opts.token or opts.md5 is None:
print "Missing required param; run with --help for usage"
sys.exit(-1)
if opts.filename is None:
opts.filename = "%s.zip" % (opts.md5,)
# build a cbapi object
#
cb = cbapi.CbApi(opts.url, token=opts.token, ssl_verify=opts.ssl_verify)
# perform a single binary search
#
binary = cb.binary(opts.md5)
# open the file and write out the contents
#
open(opts.filename, "w").write(binary)
print "-> Downloaded binary %s [%u bytes]" % (opts.md5, len(binary))
评论列表
文章目录