google-admin-sdk - Google Meet API 错误:Python 得到了一个意外的关键字参数
问题描述
我正在尝试获取有关 Google Meet 会议的信息。当我没有通过 Google Meet Id 时,我可以获得与应用程序 Google Meet 相关的所有信息。但是当我通过 meeting_code 时,我收到以下错误。https://developers.google.com/admin-sdk/reports/v1/appendix/activity/meet
def main():
creds = service_account.Credentials.from_service_account_file('srv.json', scopes=SCOPES, subject='admin@*****.com')
service = build('admin', 'reports_v1', credentials=creds)
# filters = [{'meeting_code': 'cyo-cdzc-tqp'}]
results = service.activities().list(userKey='all', applicationName='meet', maxResults=5, meeting_code='cyo-cdzc-tqp').execute()
print(results)
if __name__ == '__main__':
main()
TypeError: Got an unexpected keyword argument "meeting_code"
解决方案
应该传递的参数是(列出方法)
userKey, applicationName, maxResults, filters
现在你需要使用会议代码进行过滤,所以通过
filters='meeting_code==cyocdzctqp'
您应该传递不带连字符的会议代码
from googleapiclient.discovery import build
from google.oauth2 import service_account
import pprint
pp = pprint.PrettyPrinter(indent=4)
SCOPES = ['https://www.googleapis.com/auth/admin.reports.audit.readonly']
def main():
creds = service_account.Credentials.from_service_account_file('srv.json', scopes=SCOPES, subject='admin@***.**')
service = build('admin', 'reports_v1', credentials=creds)
results = service.activities().list(userKey='all', applicationName='meet', maxResults=5, prettyPrint=True, filters='meeting_code==cyocdzctqp' ).execute()
pp.pprint(results)
if __name__ == '__main__':
main()
推荐阅读
- python - 使用 beautifulsoup 和 Python 抓取 html 数据
- redis - 创建名为“enableRedisKeyspaceNotificationsInitializer”的 bean 时出错
- spring - Spring 无论如何都将静态内容作为 application/json 提供
- c# - AES-128-GCM 标签不匹配
- typescript - 将变量传递给 RXJS 中的第二个 Map
- scala - Gatling - 检查响应正文字符串键是否为特定值
- python - 如何将具有日期范围的行转换为具有每个日期的行?
- vue.js - 我从 Graphql 游乐场和前端得到不同的结果
- image - 模型在 loss.backward() 处停止并显示“非法指令提示”
- android - 如何通过 Koin 提供具有接口的 ViewModel