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.json
forOAuth 2.0 Client IDs
(Detailed steps to do this provided in the end) - Rename
client_secret.json
file tocredentials.json
- Move
drive-watcher.py
,requirements.txt
from this repo and thecredentials.json
file to a single directory - Open
drive-watcher.py
and replaceenter_file_id_here
with the file ID you want to watch - You can also modify
duration_in_minutes
value 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 Library
section serach forGoogle Drive API
andEnable
it - Now from the side menu, navigate to
credentials
and tap onConfigure Consent Screen
button - Select
User Type
asExternal
and tap onCREATE
button, you will seeOAuth consent screen
open up - Just fill in the
Application name
field with any name of your choice that you want to use for this script and tap onSave
button at the bottom of the page - Navigate to the
Credentials
section from side menu, tap on+ Create Credentials
button and selectOAuth client ID
option - Select
Desktop app
as theApplication Type
and tap onCREATE
button, you will see aOAuth client created
pop up, tapOK
- Now from
OAuth 2.0 Client IDs
download theclient_secret.json
you just created
It might take a few minutes for the drive API to get enabled on your account so sit back and relax