我从快速入门(https://developers.google.com/google-apps/calendar/quickstart/python)开始,效果很好。然后我尝试使用本指南插入事件(https://developers.google.com/google-apps/calendar/create-events)。我将此代码添加到快速入门的代码中,但出现错误。应该如何查看我的代码以在我的谷歌日历中插入事件?
所以这是我的代码:
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
import oauth2client
from oauth2client import client
from oauth2client import tools
import datetime
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
# If modifying these scopes, delete your previously saved credentials
# at ~/.credentials/calendar-python-quickstart.json
SCOPES = 'https://www.googleapis.com/auth/calendar'
CLIENT_SECRET_FILE = 'client_secret.json'
APPLICATION_NAME = 'Google Calendar API Python Quickstart'
def get_credentials():
"""Gets valid user credentials from storage.
If nothing has been stored, …Run Code Online (Sandbox Code Playgroud)