android 接口报500,尝试扩展googlesamples/androidplaypublisherapi进行订阅时出现500 HttpError...

我需要撤销我的应用程序订阅,这样我就可以取消订阅了。这显然不可能仅仅使用谷歌的后端。相反,必须使用google-play-android-developer-API。在

我已经下载了pythonandroid play publisher samples,并让它们正常工作。例如,我可以运行basic_list_apks.py脚本来查看apk的列表。这表明我正确地证明了自己

我扩展了相同的basic_list_apks.py来创建一个最小的subscription_revoker.py脚本(内容如下)。它似乎向谷歌传达了正确的细节。如果我把这三个参数(packageName,productId,或purchaseToken)中的任何一个错误,我会从服务器得到一个适当的错误。e、 g."Subscription not found for this application."或{}等

但是,当一切似乎都是正确的,我得到的只是一个500服务器错误:googleapiclient.errors.HttpError:

或者再写一遍,加上换行符以使其更清晰:

^{pr2}$

(我更改了错误的[括号中的]部分,以保持代码的私密性。)

我在google上到处搜索,似乎还有其他人从google那里得到了500个神秘的错误,但没有解决方案。任何帮助都将不胜感激。在

这是我的剧本。要运行它,请下载示例安装上面提到的samples,并将以下内容放入同一目录中的一个文件中并运行它。谢谢任何人能提供的帮助。在import sys

from apiclient import sample_tools

from oauth2client import client

## the values you'll need to change

package_name = 'com.yourcompany.yourapp'

product_id = 'the subscription SKU'

purchase_token = 'the purchase token'

## ## ## ##

def main(argv):

# Authenticate and construct service.

service, flags = sample_tools.init(

argv,

'androidpublisher',

'v2',

__doc__,

__file__,

parents=[],

scope='https://www.googleapis.com/auth/androidpublisher')

try:

request = service.purchases().subscriptions().revoke(packageName=package_name,

subscriptionId=product_id,

token=purchase_token)

result = request.execute()

print(result)

except client.AccessTokenRefreshError:

print ('The credentials have been revoked or expired, please re-run the '

'application to re-authorize')

if __name__ == '__main__':

main(sys.argv)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值