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

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

问题描述

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

  gsutil cp gs:// pubsite_prod_rev_<我的项目ID> / stats / installs / installs_< my app id> _201502_overview.csv。 

另一方面,gsutil为观看Google Cloud Storage存储桶,因此每当存储桶中的对象发生变化时( gsutil通知watchbucket )。我也可以在自己的Google Cloud项目中启用存储区中的通知。

玩水桶。它甚至有可能吗?

 <$ c $  c> gsutil通知watchbucket -i playnotif -t sometoken https://notif.mydomain.com gs:// pubsite_prod_rev_<我的项目ID> 




  • 我已完成所有步骤这里,特别注意那些关于识别要接收通知的域
  • 我上面提到过,我已经能够完成我需要的所有流程,但在Google Cloud中使用我自己的存储桶,而不是在Google Play存储桶中。

  • Google Play项目已链接到Google Cloud项目。 Google Play开发者控制台 - >配置(左侧菜单) - > API访问权限)时,它会自动完成。

  • Google Play项目所有者和我自己的Google Cloud项目所有者是相同的。

  • 该所有者已成功注册和验证用于接收通知的域(以下示例中,我验证了两种情况: notif .mydomain.com mydomain.com ,在 Google网站管理员工具

  • 这些网域也已列入谷歌开发者控制台(左边栏 - > API和认证 - >推送)。
  • 已使用项目所有者帐户或我创建的服务帐户在我自己的Google Cloud存储桶中成功启用了通知。我已经尝试在Google Play存储分区中同时使用两者(所有者和相应的服务帐户),但未获成功。 不胜感激。谢谢!



    编辑: 我已经按照这里,但使用不同的程序(如下面的评论中所述)。按照Nikita的建议,我试图按照相同的步骤操作。



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

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

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

      $ gsutil acl ch -u my-play-store-service-account@developer.gserviceaccount.com:FC gs:// pubsite_prod_rev_my-bucket-id 
    CommandException:无法为gs设置acl: // pubsite_prod_rev_my斗-ID /。请确保您拥有对此资源的OWNER角色访问权限。

    因此,我尝试列出此存储桶的默认ACL,并找到:

      $ gsutil defacl get gs:// pubsite_prod_rev_my-bucket-id 
    gs:// pubsite_prod_rev_my-bucket- ID。如果默认对象ACL是私有的,则会发生这种情况,在这种情况下,在该存储桶中创建的对象只能由其创建者读取。这也可能意味着您对gs:// pubsite_prod_rev_my-bucket-id没有OWNER权限,因此没有读取默认对象ACL的权限。
    []

    结论:



    这真的让我觉得,即使使用项目所有者帐户,该帐户在Play商店存储分区中也没有OWNER角色。这意味着ACL不能被修改,甚至没有列出,以及通知不能被启用,因为可悲的是,我们并没有真正拥有存储桶。

    解决方案

    目前,你不能。 Google Play拥有这些存储分区,并且最终用户没有订阅 FULL_CONTROL 访问权限docs / object-change-notificationrel =nofollow>对象变更通知


    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 .
    

    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.

    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>
    

    • 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!

    EDIT:

    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.

    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.
    

    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.
    []
    

    Conclusion:

    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.

    解决方案

    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天全站免登陆