main.py 文件源码

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

项目:gce_metadata_server 作者: salrashid123 项目源码 文件源码
def authcheck():

    scope='https://www.googleapis.com/auth/userinfo.email'
    try: 
      credentials = GoogleCredentials.get_application_default()
      if credentials.create_scoped_required():
        credentials = credentials.create_scoped(scope)
    except ApplicationDefaultCredentialsError:
      return "Unable to acquire application default credentials"

    http = httplib2.Http()
    credentials.authorize(http)

    service = build(serviceName='oauth2', version= 'v2',http=http)
    resp = service.userinfo().get().execute()
    return resp['email']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号