Watch Google Drive file modifications
To run this script, you'll need:
- Python 2.6 or greater
- The pip package management tool
- A Google account with Google Drive enabled
- Setup Python on your system
- Create a project on Google API Console, enable drive api and get
client_secret.jsonforOAuth 2.0 Client IDs(Detailed steps to do this provided in the end) - Rename
client_secret.jsonfile tocredentials.json - Move
drive-watcher.py,requirements.txtfrom this repo and thecredentials.jsonfile to a single directory - Open
drive-watcher.pyand replaceenter_file_id_herewith the file ID you want to watch - You can also modify
duration_in_minutesvalue if you want more frequent updates, the current default is set to 180 minutes (3 hours) - Run
pip install -r requirements.txt - Save and run
drive-watcher.py - If you are running the script for the first time, it will open your browser window and ask you to grant permissions to you app. Proceed to grant the permission and then close that window.
- Bingo! you are all set now. You will receive a system notification whenever the watched file gets modified. Clicking on the notification will open the file link in your default web browser.
Drive watcher shows the OS notification so in case you want it to be a sticky alert,
you can easily modify that by going to :
System Preferences -> Notifications -> terminal-notifier -> Change notification type to Alerts
- Go to the Google API console and create a new project
- Now in the
API Librarysection serach forGoogle Drive APIandEnableit - Now from the side menu, navigate to
credentialsand tap onConfigure Consent Screenbutton - Select
User TypeasExternaland tap onCREATEbutton, you will seeOAuth consent screenopen up - Just fill in the
Application namefield with any name of your choice that you want to use for this script and tap onSavebutton at the bottom of the page - Navigate to the
Credentialssection from side menu, tap on+ Create Credentialsbutton and selectOAuth client IDoption - Select
Desktop appas theApplication Typeand tap onCREATEbutton, you will see aOAuth client createdpop up, tapOK - Now from
OAuth 2.0 Client IDsdownload theclient_secret.jsonyou just created
It might take a few minutes for the drive API to get enabled on your account so sit back and relax