启用通知/观看 Google Play 存储桶以编程方式下载报告 [英] Enable notifications / Watch a Google Play bucket to programatically download reports

查看:23
本文介绍了启用通知/观看 Google Play 存储桶以编程方式下载报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多关于 如何使用 gsutil 工具以编程方式下载 Google Play 报告.Google Play 使用存储桶来存储这些报告,就像 Google Cloud Storage 一样.我已经可以毫无问题地从 Google Play 存储桶下载报告.例如:

There's a lot of new information regarding how to programatically download Google Play reports using gsutil tool. Google Play uses a bucket to store these reports, just like Google Cloud Storage does. I'm already able to download reports from Google Play bucket without a problem. For example:

gsutil cp gs://pubsite_prod_rev_<my project id>/stats/installs/installs_<my app id>_201502_overview.csv .

另一方面,gsutil 提供了一项功能来观看 Google Cloud Storage 存储分区,因此您可以在每次存储桶中的对象发生更改时收到通知(gsutil 通知 watchbucket).我还可以在我自己的 Google Cloud 项目中创建的存储分区中启用通知.

On the other hand, gsutil offers a feature to watch Google Cloud Storage buckets, so you can receive notifications every time an object in the bucket changes (gsutil notification watchbucket). I am also able to enable notifications in buckets created in my own Google Cloud projects.

问题是,我无法在 Google Play 存储桶中启用通知.甚至有可能吗?调用时出现 AccessDeniedException: 403 Forbidden 错误:

The problem is, I'm not able to enable notifications in my Google Play bucket. Is it even possible? I get an AccessDeniedException: 403 Forbidden error when calling:

gsutil notification watchbucket -i playnotif -t sometoken https://notif.mydomain.com gs://pubsite_prod_rev_<my project id>

  • 我已按照此处的所有步骤操作,特别小心与那些关于识别域以接收通知.
  • 正如我上面提到的,我已经能够完成我需要的所有过程,但是使用 Google Cloud 中我自己的存储桶,而不是使用 Google Play 存储桶.
  • Google Play 项目已关联到 Google Cloud 项目.当我启用 Google Play API 访问权限(Google Play 开发者控制台 -> 配置(左侧菜单)-> API 访问权限)时,它会自动执行此操作.
  • Google Play 项目所有者和我自己的 Google Cloud 项目所有者相同.
  • 此所有者已成功注册并验证用于接收通知的域(按照示例,我验证了两者以防万一:notif.mydomain.commydomain.com,在 Google 网站管理员工具中使用 https)
  • 这些域也已在 Google Developers Console(左侧侧边栏 -> API 和身份验证 -> 推送).
  • 我已使用我创建的项目所有者帐号或服务帐号在我自己的 Google Cloud 存储分区中成功启用了通知.我已经尝试在 Google Play 存储分区中同时使用(所有者和相应的服务帐户),但没有成功.
    • I've followed all the steps here, being specially careful with those regarding identifying a domain to receive notifications.
    • As I mentioned above, I'm already able to do all the process I need, but with my own buckets in Google Cloud, not with the Google Play bucket.
    • The Google Play project has been linked to a Google Cloud project. It did so automatically when I enabled Google Play API access (Google Play Developer Console -> Configuration (left menu) -> API access).
    • The Google Play project owner and my own Google Cloud project owner is the same.
    • This owner has successfully registered and validated the domain used to receive the notifications (following the example, I validated both just in case: notif.mydomain.com and mydomain.com, using https in the Google Webmaster Tools)
    • These domains have also been whitelisted in the Google Developers Console (left sidebar -> APIs & Auth -> Push).
    • I've successfully enabled notifications in my own Google Cloud buckets using either the project owner account or a service account I created. I've already tried using both (owner and a corresponding service account) in the Google Play bucket, without success.
    • 任何想法将不胜感激.谢谢!

      Any ideas will be greatly appreciated. Thanks!

      我已经按照此处的步骤操作,但使用不同的程序(如以下评论中所述).按照 Nikita 的建议,我尝试使用相同的步骤来执行这些步骤.

      I had already followed the steps here, but using different procedures (as explained in the comment below). Following Nikita's suggestion, I tried to follow the steps using the same procedure.

      所以我将 gsutil(通过 gcloud)配置为使用所有者帐户:

      So I configured gsutil (through gcloud) to use the owner account:

      gcloud config set account owner-of-play-store-project@gmail.com
      

      在尝试授予对服务帐户的完全访问权限时,我遇到了以下错误:

      and while trying to grant full access to the service account, I encountered this error:

      $ gsutil acl ch -u my-play-store-service-account@developer.gserviceaccount.com: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,发现:

      So, I tried to list the default ACL for this bucket, and found:

      $ 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 无法修改,甚至无法列出,也无法启用通知,因为遗憾的是,我们并不真正拥有存储桶.

      It really makes me think that, even using the project owner account, this account doesn't have the OWNER role on the Play Store bucket. This means ACLs can't be modified, not even listed, as well as notifications can't be enabled since, sadly, we don't really own the bucket.

      推荐答案

      目前,您不能.Google Play 拥有这些存储分区,而最终用户没有订阅 对象更改通知.

      At the moment, you cannot. Google Play owns these buckets, and end users do not have the bucket FULL_CONTROL access necessary to subscribe to Object Change Notifications.

      这篇关于启用通知/观看 Google Play 存储桶以编程方式下载报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆