有很多关于的新信息如何以编程方式下载 Google Play 报告 using gsutil工具。 Google Play 使用存储桶来存储这些报告,就像 Google Cloud Storage 一样。我已经能够毫无问题地从 Google Play 存储桶下载报告。例如:
gsutil cp gs://pubsite_prod_rev_<my project id>/stats/installs/installs_<my app id>_201502_overview.csv .
另一方面,gsutil 提供了一个功能观看 Google Cloud Storage 存储桶,这样您就可以在每次存储桶中的对象发生变化时收到通知(gsutil notification watchbucket
)。我还可以在我自己的 Google Cloud 项目中创建的存储桶中启用通知。
问题是,我无法在 Google Play 存储桶中启用通知。有可能吗?我得到一个AccessDeniedException: 403 Forbidden
调用时出错:
gsutil notification watchbucket -i playnotif -t sometoken https://notif.mydomain.com gs://pubsite_prod_rev_<my project id>
- 我已遵循所有步骤here,特别小心那些关于识别接收通知的域.
- 正如我上面提到的,我已经能够完成我需要的所有流程,但使用的是 Google Cloud 中我自己的存储桶,而不是 Google Play 存储桶。
- Google Play 项目已链接到 Google Cloud 项目。当我启用 Google Play API 访问(Google Play 开发者控制台 -> 配置(左侧菜单) -> API 访问)时,它会自动执行此操作。
- Google Play 项目所有者和我自己的 Google Cloud 项目所有者是同一个人。
- 该所有者已成功注册并验证了用于接收通知的域(在示例中,我验证了这两个域,以防万一:
notif.mydomain.com
and mydomain.com
,在中使用 https谷歌网站管理员工具)
- 这些域名也已被列入白名单谷歌开发者控制台(左侧边栏 -> API 和身份验证 -> 推送)。
- 我已使用项目所有者帐号或我创建的服务帐号在自己的 Google Cloud 存储桶中成功启用了通知。我已经尝试在 Google Play 存储桶中同时使用两者(所有者和相应的服务帐户),但没有成功。
任何想法将不胜感激。谢谢!
EDIT:
我已经按照步骤操作了here,但使用不同的程序(如下面的评论中所述)。按照 Nikita 的建议,我尝试使用相同的过程来执行这些步骤。
因此,我将 gsutil 配置为(通过 gcloud)使用所有者帐户:
gcloud config set account [email protected]
在尝试授予对服务帐户的完全访问权限时,我遇到了以下错误:
$ gsutil acl ch -u [email protected]:FC gs://pubsite_prod_rev_my-bucket-id
CommandException: Failed to set acl for gs://pubsite_prod_rev_my-bucket-id/. Please ensure you have OWNER-role access to this resource.
因此,我尝试列出该存储桶的默认 ACL,结果发现:
$ gsutil defacl get gs://pubsite_prod_rev_my-bucket-id
No default object ACL present for gs://pubsite_prod_rev_my-bucket-id. This could occur if the default object ACL is private, in which case objects created in this bucket will be readable only by their creators. It could also mean you do not have OWNER permission on gs://pubsite_prod_rev_my-bucket-id and therefore do not have permission to read the default object ACL.
[]
结论:
这确实让我觉得,即使使用项目所有者帐户,该帐户在 Play 商店存储桶上也不具有 OWNER 角色。这意味着 ACL 无法修改,甚至无法列出,也无法启用通知,因为遗憾的是,我们实际上并没有own水桶。