RENOUNCEMENT:
I am not a security expert and I donβt know the risks associated with my terrible solution to the problem ... but this will lead to Cron running the code.
If you are ready to do manual manual reception once for your application with a specific scope, as in the Google quick-start example (useful parts located at the bottom of the answer): https://developers.google.com/drive/web/quickstart/python
You can then add both the CLIENT_SECRET_FILE AND drive-quickstart.json files that you created once to your repository. Then, if you have a Google account in which you always want ANY copy of your code base to have access to it, there will never be a second credential check.
DENIAL OF RESPONSIBILITY:
Intuitively, this solution is terrible for security, and the moment your code base is published ANY way, your Google drive is completely at risk of destruction, deletion, ban, etc.
import httplib2 import os from apiclient import discovery import oauth2client from oauth2client import client from oauth2client import tools def get_credentials(): try: import argparse flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args() except ImportError: flags = None SCOPES = 'https://www.googleapis.com/auth/drive'
source share