I successfully uploaded the file to google drive as follows https://pythonhosted.org/PyDrive/quickstart.html, https://pythonhosted.org/PyDrive/oauth.html#automatic-and-custom-authentication-with-settings-yaml
however, cron job couldn't make upload the file to google drive through execute the same file.
here's my setting
download client_secrets.json
quickstart.py
from my drive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
gauth.CommandLineAuth() # gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
.
.
def create_csv()
.
.
def upload()
.
.
settings.yaml
client_config_backend: settings
client_config:
client_id: ***
client_secret: ***
save_credentials: True
save_credentials_backend: file
save_credentials_file: credentials.json
get_refresh_token: True
oauth_scope:
- https://www.googleapis.com/auth/drive.file
- https://www.googleapis.com/auth/drive.install
why cron job doesn't work? because of the OAuth?
thanks