我正在尝试编写一个 python 脚本来从 Google 日历中获取条目。
我收到以下行的 NameError: name 'build' is not Defined
:
service = build('日历','v3',credentials=credentials)
对于如何解决这个问题有什么建议吗?
最佳答案
您可以使用Python Quickstart for Calendar API作为引用。
在导入部分注意构建方法源自哪个模块:
from __future__ import print_function
from apiclient.discovery import build //notice the build here
from httplib2 import Http
from oauth2client import file, client, tools
import datetime
在此使用之前:
service = build('calendar', 'v3', http=creds.authorize(Http()))
关于python - 名称错误 : name 'build' is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51488811/