Before you going to coming paragraphs of this article, I recommend you to watch following youtube video so you will get what is going to describe here:
Read following links to learn more about the authentication mechanism google API is using :
As Claudio (GOOGLE) mentioned in the above video, (http://youtu.be/zJVCKvXtHtE?t=12m18s), we need to use some logic (client library) to sort your crendentials for reusing. Other wise on every execution of ‘quickstart.py’ script, you need human interaction for getting tokens. I added 6 lines to google’s ‘quickstart.py’ to keep authorization code for reusing. So as long as the user has not revoked the access granted initially to the application, you don’t need a human interaction.
For more details : https://developers.google.com/accounts/docs/OAuth2InstalledApp#refresh
You can get modified google’s quickstart.py using following
git clone firstname.lastname@example.org:sukujgrg/google_drive.git
So, you got the idea how to deal with Google API and authentication to Google drive without human interaction. Now, you just need to apply your modifications to the script, suitable to your environment and then just put a cron job.