google-play-developer-api - Google Play Developer API:什么是 APK 的编辑标识符以及(如何)以编程方式找到它
问题描述
我正在尝试使用 GP Developer API(没有多大成功)并继续返回 editID 的问题。例如,在 Edits.apks:list 的参考页面上,我们看到了一个 HTTP 请求示例:
GET https://www.googleapis.com/androidpublisher/v3/applications/packageName/edits/editId/apks
那里的editId是什么?对于已经上传到 GP 控制台的 APK,我在哪里可以找到它?更好的是,我可以使用 API 本身找到它吗?
解决方案
如果有人像我一样对 GP 文档感到困惑:
GP Developer API docs for Edits(恭喜你,如果你只是想获得一些信息,你应该在名为“Edits”的页面上)咕哝着关于“调用Edits:插入并指定要修改的应用程序” 。” 我不想以任何方式插入任何内容或修改任何内容,但是可以。然后“您可以通过调用适当的方法来进行更改 [...] 并传递应用程序的 ID 并编辑您想要修改的内容。” 哪个编辑ID?
长话短说,看起来 GP 希望您为您将与他们的服务器进行的每个交换会话请求一个标记,然后用该标记标记所有交互。获得标记的方法是使用您的 apk 名称调用 insert 函数,并且没有其他参数(duh)。
所以在python中它应该看起来像这样:
from googleapiclient import discovery
from google.oauth2 import service_account
package_name = "com.pkg.name"
scopes = ['https://www.googleapis.com/auth/androidpublisher']
sa_file = "your_key.json"
credentials = service_account.Credentials.from_service_account_file(sa_file, scopes=scopes)
# see the list of discoverable api's here https://www.googleapis.com/discovery/v1/apis
service = discovery.build('androidpublisher', 'v3', credentials=credentials)
# note that insert() returns a request that needs to be exexuted
request = service.edits().insert(packageName=package_name)
response = request.execute()
editId = response['id']
# say you want to know the details about your package
request = service.edits().details().get(packageName=package_name, editId=editId)
response = request.execute()
print(response)
那里。
推荐阅读
- react-native - React-Native WebView 阻止父 TouchableOpacity 上的 onPress
- r - 传播数据并计算 RMSE
- css - 当元素没有某个类的祖先时,如何有选择地应用 CSS
- vim - vim 在 tmux 中用 Cs 冻结
- html - /和_在html中是什么意思?
- c# - 如何通过 LiteDB.LiteCollection 迭代大型 litedb 数据库文件中的特定键值
- azure - 部署 Microsoft Azure 的 FACE API 时如何修复错误
- webview - 如何从资产加载完整的网站?
- nutch - 如何解决运行 Nutch 1.15 ERROR fetcher.Fetcher - Fetcher 作业未成功,作业状态:FAILED,原因:NA 的此错误
- php - 回声问题,循环 4 次