google.py 文件源码

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

项目:cpcloud 作者: dana-at-cp 项目源码 文件源码
def list_instances(client_cert_file, client_email, project, zone):
    with open(client_cert_file) as f:
        private_key = f.read()
    credentials = SignedJwtAssertionCredentials(client_email, private_key,
        'https://www.googleapis.com/auth/compute.readonly')
    http = Http()
    credentials.authorize(http)
    try:
        compute = build('compute', 'v1', http=http)
        resp_json = compute.instances().list(project=project, zone=zone).execute()
    except HttpError:
        raise GoogleClientError('Failed to make "list instances" Google cloud API request')
    return resp_json
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号