I have been using Pandas for accessing and analysing my Google analytics data for several months however yesterday my code failed and I'm not sure why. Even using the most basic example (as given in the documentation) the ga.read_ga function is returning an error:
AttributeError Traceback (most recent call last)
/Library/Python/2.7/site-packages/ipython-0.13.1-py2.7.egg/IPython/utils/py3compat.pyc in execfile(fname, *where)
176 else:
177 filename = fname
--> 178 __builtin__.execfile(filename, *where)
/Users/danielcollins/Documents/GA Python/EngCompCombined.py in <module>()
161 # account_id=account_id,
162 max_results=max_results,
--> 163 chunksize=5000)
164
165 df1_conc = pd.concat([x for x in df1])
/Library/Python/2.7/site-packages/pandas/io/ga.py in read_ga(metrics, dimensions, start_date, **kwargs)
100 reader = GAnalytics(**reader_kwds)
101 return reader.get_data(metrics=metrics, start_date=start_date,
--> 102 dimensions=dimensions, **kwargs)
103
104
/Library/Python/2.7/site-packages/pandas/io/ga.py in get_data(self, metrics, start_date, end_date, dimensions, segment, filters, start_index, max_results, index_col, parse_dates, keep_date_col, date_parser, na_values, converters, sort, dayfirst, account_name, account_id, property_name, property_id, profile_name, profile_id, chunksize)
254
255 account = self.get_account(account_name, account_id)
--> 256 web_property = self.get_web_property(account.get('id'), property_name,
257 property_id)
258 profile = self.get_profile(account.get('id'), web_property.get('id'),
AttributeError: 'NoneType' object has no attribute 'get'
The format of the request is:
df1 = ga.read_ga(metrics,
dimensions = dimensions,
start_date = start_date,
end_date = end_date,
token_file_name = '-------',
filters = filters,
max_results=max_results,
chunksize=5000)
I have never had to specify my account-id, profile-id etc but i have tried hardcoding them without much luck. This script was collecting data everyday until yesterday and I have not touched either my python script or my GA account config.
I am running Pandas 0.11.0 however I have tried reverting to 0.10.1 to see if the error remains.
Authentication flow via refresh token seems to work fine.
I really appreciate any suggestions.