I just installed Anaconda (with Python 3 as default), as I need it for pandas/accessing Google Analytics. Here is some info about accessing GA through Python & pandas: http://pandas.pydata.org/pandas-docs/stable/remote_data.html#remote-data-ga
A similar question was asked here Google API client secrets error (Python) but the answer does not seem helpful in my particular case. Namely, the error I have is different; I've placed the client_secrets.json file in the appropriate directory; the file is not empty and has the exact same contents as shown in the developer console.
Here is the code and error:
import numpy as np
import pandas as pd
import pandas.io.ga as ga
from pandas import Series, DataFrame
df = ga.read_ga(metrics='sessions', dimensions='date', start_date='2015-07-01')
An exception has occurred, use %tb to see the full traceback.
SystemExit:
WARNING: Please configure OAuth 2.0
You need to populate the client_secrets.json file found at:
/Users/usernamehere/anaconda/envs/py2/lib/python2.7/site-packages/pandas/io/client_secrets.json
with information from the APIs Console <https://code.google.com/apis/console>.
Some extra details about the setup:
- Besides Anaconda, I've also installed the Google API library and GFlags
- It appears GFlags is not compatible with Python 3, so I created a new environment using the
conda create
method - The Google account used to access the Google Developer Console has two-factor auth enabled