def get_report(analytics):
return analytics.reports().batchGet(
body={
'reportRequests':
[
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '7daysAgo', 'endDate': 'today'}],
'metrics': [{'expression':i} for i in METRICS],
'dimensions': [{'name':j} for j in DIMENSIONS]
}
]
}
).execute()
在执行文件“ /home/mail_name/gaToPandas/lib/python3.5/site-packages/googleapiclient/http.py”的第851行 引发HttpError(resp,content,uri = self.uri) googleapiclient.errors.HttpError:https://analyticsreporting.googleapis.com/v4/reports:batchGet?alt=json返回了“ viewId参数无效的值'project-id@appspot.gserviceaccount.com”。“>
如何解决此问题? 该网站https://www.digishuffle.com/blogs/google-analytics-reporting-python/
的步骤3中存在错误