100 Scripts in 30 Days challenge: Script 4 — Getting Event details from Google Calendar using Python
I have always wanted to get the details of my Google Calendar to be a power user so that I am always up to date on my schedule as I conduct meetups and other events and also to check if I am missing anything.
Much of the content of the script is inspired from the below link:
from __future__ import print_function import httplib2 import os from apiclient import discovery from oauth2client…developers.google.com
The only changes being that I have added steps to add the data to a sqlite database for future use and get a complete extract into csv format.
Step 1: Turn on the Google Calendar API
- Use console wizard to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.
- On the Add credentials to your project page, click the Cancel button.
- At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.
- Select the Credentials tab, click the Create credentials button and select OAuth client ID.
- Select the application type Other, enter the name “Google Calendar API Quickstart”, and click the Create button.
- Click OK to dismiss the resulting dialog.
- Click the file_download (Download JSON) button to the right of the client ID.
- Move this file to your working directory and rename it
Step 2: Install the Google Client Library & Other dependencies
pip install — upgrade google-api-python-client
pip install appdirs
And other dependencies as present in the script.
- Create conf_sample.toml under conf directory.
- Run the code as “python google_calendar_details.py”
Code for the Script:
For any further details you can contact me on twitter https://twitter.com/twitmyreview or https://www.linkedin.com/in/priyabrata-dash-21616b15/.
All feedback and suggestions are welcome.