I want to retrieve data from Google analytics. I have created a service account in the console and I am using Google's Python (hello_analytics_api_v3.py
) code to access the data.
I have copied the client_secrets.json
into my folder but get this error:
*SystemExit:
WARNING: Please configure OAuth 2.0
To make this sample run you will need to populate the client_secrets.json file
found at:*
What should I do? I am using Python 2.7.
Ensure the terminal is pointing to the same path directory as your client_secrets.json
file.
i.e. type pwd
in the console you're using to call the script and the output should match the directory of where client_secrets.json
is stored.
I was having this exact issue and deleted the credentials to my project and creating new ones using the 'OAuth client ID' option. Follow step one of this page closley https://developers.google.com/analytics/devguides/config/mgmt/v3/quickstart/installed-py
I also found a syntax error in the sample code provided by google The Lines:
print 'View (Profile): %s' % results.get('profileInfo').get('profileName')
print 'Total Sessions: %s' % results.get('rows')[0][0]
Should read:
print ('View (Profile): %s' % (results.get('profileInfo').get('profileName')))
print ('Total Sessions: %s' % (results.get('rows')[0][0]))
At least this solved it for me. Also, make sure the client_secrets.json is in the same directory as your python script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With