Can't find Google Python API sync example

217 Views Asked by At

I need to see an example of Google Calendar API Sync (https://developers.google.com/google-apps/calendar/v3/sync) working with Python. Can someone please provide me with one?

2

There are 2 best solutions below

0
On

You may check this tutorial. This tool is written in python to bidirectional synchronize a local iCal (.ics) file with Google Calendar.

How to use googlecalendarsync

Create a configuration file ($HOME/.googlecalsync/config) using the following template:

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

Then run: googlecalsync.py [--dry-run]

Recommended usage

Add an entry in crontab (as non-privileged user) like the following to synchronize a local calendar with Google Calendar every 30mins:

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

Hope this helps!

0
On

Here is a example how to partial sync with python:

def get_list_event_update():
    calendar_id = "[email protected]"
    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)