python - 使用服务帐户返回密钥错误的 Google API
问题描述
我不确定我在这里做错了什么,这里的代码基本上取自文档。但是,在运行此代码时,我收到一个关键错误:access_token:
from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
SCOPES = ['https://www.googleapis.com/auth/admin.directory.user'
'https://www.googleapis.com/auth/admin.directory.group.member',
'https://www.googleapis.com/auth/admin.directory.group.member.readonly',
'https://www.googleapis.com/auth/admin.directory.group.readonly']
credentials = ServiceAccountCredentials.from_json_keyfile_name(
'keyfilecredentials.json',
scopes=SCOPES)
service = build('admin', 'directory_v1', credentials=credentials)
list = service.users().list().execute()
解决方案
推荐阅读
- api - prestashop 1.7.6.4 webservice POST api 请求错误 405 无效
- angularjs - docker容器中的Jhipster Angular App,不在生产模式下运行
- tensorflow - 减少数据集的类
- apache-spark - 即使在使用带有 collect_set 的窗口后,列表也是无序的
- c# - 如何在 C# 中使用反射调用重载方法。模糊匹配异常
- sql - 当列的值未更改时,更新如何在 SQL Server 中工作
- c# - 我想加入2张桌子
- javascript - Nextjs getInitialProps 阻止了客户端的页面渲染?
- sql-server - 报告服务器审查
- laravel - 如何在 Laravel 中设置屏蔽重定向?