Querying calendar events via the Google Calendar API

<p>Do you want to pull all meetings &amp; events from&nbsp;<strong>your or any shared Google calendar</strong>&nbsp;via the Google calendar API in Python? This blogpost provides step-for-step instructions on how to setup&nbsp;<strong>authentication</strong>,&nbsp;<strong>request calendar events</strong>&nbsp;and handle the&nbsp;<strong>pagination token</strong>. For the full code, check the&nbsp;<a href="https://github.com/chrieke/calendar-insights/blob/main/query_google_calendar_api.ipynb" rel="noopener ugc nofollow" target="_blank">calendar-insights repository</a>.</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/1*Hxj5GCeOlILo0uxUf4JXfw.jpeg" style="height:468px; width:700px" /></p> <h2><strong>Setup Google Calendar API</strong></h2> <p>First we need to&nbsp;<strong>activate the&nbsp;</strong><a href="https://developers.google.com/calendar/api/guides/overview" rel="noopener ugc nofollow" target="_blank"><strong>Google Calendar API</strong></a><strong>&nbsp;for a Google cloud project</strong>&nbsp;of our choice. Use an existing project or create a new one: At the top of the&nbsp;<a href="https://console.cloud.google.com/" rel="noopener ugc nofollow" target="_blank">Google Cloud Console dashboard</a>, click on the project selection and &ldquo;New Project&rdquo;, enter a name e.g. &ldquo;calendar-insights&rdquo; and click &ldquo;Create&rdquo;. Then, in the&nbsp;<a href="https://console.developers.google.com/" rel="noopener ugc nofollow" target="_blank">Google API dashboard</a>, click&nbsp;<em>Enable APIs and services</em>. Search for the Google Calendar API and click&nbsp;<em>Enable</em>.</p> <p>Next, to enable API queries from our local computer, we need to create and&nbsp;<strong>download authentication credentials</strong>&nbsp;for that project. In the&nbsp;<a href="https://console.cloud.google.com/apis/credentials" rel="noopener ugc nofollow" target="_blank">Credentials section</a>&nbsp;of the API dashboard, click&nbsp;<em>Create Credentials</em>&nbsp;and&nbsp;<em>OAuth Client ID.&nbsp;</em>Select Application type &ldquo;Desktop app&rdquo;. Then click &ldquo;Download JSON&rdquo; and store the credentials file on your local PC.</p> <p><a href="https://chrieke.medium.com/querying-calendar-events-via-the-google-calendar-api-771782e24f62"><strong>Read More</strong></a></p>