【问题标题】:Can't find Google Python API sync example找不到 Google Python API 同步示例
【发布时间】:2017-05-17 12:14:59
【问题描述】:

我需要查看一个使用 Python 的 Google Calendar API Sync (https://developers.google.com/google-apps/calendar/v3/sync) 示例。有人可以给我一份吗?

【问题讨论】:

    标签: google-api google-api-python-client google-calendar-api google-python-api


    【解决方案1】:

    您可以查看此tutorial。这个工具是用 python 编写的,用于将本地 iCal (.ics) 文件与 Google 日历双向同步。

    如何使用 googlecalendarsync

    使用以下模板创建配置文件 ($HOME/.googlecalsync/config):

    [google] username = password =[local] ical_file = workdir = ${HOME}/.googlecalsync/work/
    

    然后运行:googlecalsync.py [--dry-run]

    推荐用法

    在 crontab 中添加一个条目(作为非特权用户),如下所示,每 30 分钟将本地日历与 Google 日历同步一次:

    0,30 * * * * /usr/bin/googlecalsync.py >/dev/null 2>&1

    希望这会有所帮助!

    【讨论】:

      【解决方案2】:

      这是一个如何与 python 部分同步的示例:

      def get_list_event_update():
          calendar_id = "xxx@gmail.com"
          url_get_list_event_update = "https://www.googleapis.com/calendar/v3/calendars/" + calendar_id + "/events"
          querystring = {"syncToken": "here_synctoken"}
          response = requests.request("GET", url_get_list_event_update, headers=headers, params=querystring)
          print(response.text)
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-15
        • 2019-09-25
        • 2016-11-04
        • 2021-02-10
        • 2013-06-07
        • 1970-01-01
        相关资源
        最近更新 更多