小编Vik*_*min的帖子

如何使用 Python 和 Google 日历 API 创建 Google 日历事件

我从快速入门(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)

python calendar google-calendar-api google-api

11
推荐指数
1
解决办法
2万
查看次数