google-analytics - Analytics Reporting API 之前未在项目中使用过或已禁用
问题描述
错误:googleapiclient.errors.HttpError: <HttpError 403 when requesting https://analyticsreporting.googleapis.com/v4/reports:batchGet?alt=json returned "Analytics Reporting API has not been used in project 190831311549 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com/overview?project=xxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.". Details: "[{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Google developers console API activation', 'url': 'https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com/overview?project=xxxx'}]}]">
脚步:
- 在云控制台启用 Google Analytics Reporting API
- 创建服务凭证并将电子邮件作为读取/分析用户添加到 GA 帐户
- 我正在使用“Hello Analytics Reporting API V4”。蟒蛇代码
- 使用
apiclient.discovery
和analytics = build('analyticsreporting', 'v4', credentials=credentials, cache_discovery=False)
- 我还尝试了绕过我的python代码的解决方法https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet但是当我尝试执行身份验证弹出窗口时空白和装载机一直在旋转,并且 chrome 开发工具显示
Failed to load resource: net::ERR_QUIC_PROTOCOL_ERROR.QUIC_PACKET_READ_ERROR
解决方案
重定向到https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com并使用您创建了 client_id 和 client_secret 的 google 帐户登录,确保您在与客户端相同的项目中id 和 secrets 用于其他明智的更改项目。如果您没有访问权限,请让管理员执行相同操作
然后尝试做你的工作。它应该可以正常工作
推荐阅读
- python - 如何使用值列表查询数据库?
- reporting-services - 通过测试来自其他列值的值条件来填充 SSRS 报告中的单元格
- android - androidTest 中 URL.readText 的 FileNotFoundException
- sql - 具有一个标识列的 SQL Server 组合键
- javascript - 每次不同匹配的名称生成器
- tsql - 在备份\还原期间解析备份\还原路径和文件名
- git - 如何使用另一个提交开发我的代码,但不将其合并到我的补丁中
- bash - 提交脚本的 Bash 语法
- sql - 如何转储失败的 Django 查询集的完整 SQL?
- html - 模板驱动表单中的表单验证问题