download_sensor_installer.py 文件源码

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

项目:cbapi-examples 作者: cbcommunity 项目源码 文件源码
def main(argv):
    parser = build_cli_parser()
    opts, args = parser.parse_args(argv)
    if not opts.url or not opts.token or not opts.type or not opts.group or not opts.filename:
        print "Missing required param; run with --help for usage"
        sys.exit(-1)

    # build a cbapi object
    #
    cb = cbapi.CbApi(opts.url, token=opts.token, ssl_verify=opts.ssl_verify)

    # download the installer package 
    #
    print "-> Downloading..."
    bytes = cb.sensor_installer(opts.type, opts.group)
    print "-> Sensor Installer Package is %s bytes" % (len(bytes))
    print "-> Download complete"

    # save the instaler package to disk
    #
    print "-> Saving to %s..." % (opts.filename)
    open(opts.filename, 'wb').write(bytes)
    print "-> Complete"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号