Running from Cron Python/ Google API will not accept stored Credentials file but from command line it will -
so had thought functioning python script access stored google oauth credentials file.
when run:
source /metrics/virtualenvs/google/venv/bin/activate; export ld_library_path='/usr/lib/oracle/11.2/client64/lib'; /metrics/googlestats/get_report_2.py
it works famously.
in python there block check credentials stored file:
#get google storage object storage = storage('cred_storage.txt') credentials = storage.get() #check if credentials valid if not send web page new key. if not credentials: flow = oauth2webserverflow(client_id, client_secret, oauth_scope, redirect_uri) authorize_url = flow.step1_get_authorize_url() print 'go following link in browser: ' + authorize_url code = raw_input('enter verification code: ').strip() credentials = flow.step2_exchange(code) storage.put(credentials) mysendmail('re authentication of credentials necessary') exit()
all if run same thing local user crontab credentials fail if credentials file unreadable.
i'm stumped why difference running command cron vs command line.
just information "go url" message when credentials fail read.
my permissions on credentials file 0755 owner being user of local crontab.
thanks
ok id-10-t problem. forgot set working directory when moving command line cron.
duh!
onward , upward
Comments
Post a Comment