google-api-python-client を利用するときに気を付けること

サンプルのソースの言語設定が en-US になっているので、ja-JP にしないとAPIのレスポンスで403が返ってくる
まぁ、各言語圏用に自分でカスタマイズしないといけないのは仕方がないが、引数で渡せるようにとかの配慮は少しほしいところ。
情報が少なすぎてエラー調べるのに苦労したわ。

# コマンドからGooglePlayShopにアップロード
python upload_apks_with_listing.py xxxxxxx(packageName) xxxxxxx.apk(アップロードするAPK)

=========================================================

Authentication successful.
Version code 532 has been uploaded
Track alpha is set for version code(s) [532]
Listing for language en-US was updated.
Traceback (most recent call last):
  File "python/upload_apks_with_listing.py", line 89, in <module>
    main(sys.argv)
  File "python/upload_apks_with_listing.py", line 80, in main
    editId=edit_id, packageName=package_name).execute()
  File "build\bdist.win32\egg\oauth2client\util.py", line 135, in positional_wrapper
  File "build\bdist.win32\egg\googleapiclient\http.py", line 832, in execute
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/androidpublisher/v2/applications/com.example.app/edits/xxxxxxxxxx:commit?alt=json returned "Tried to set recent changes text for APK version 532 for language en-US. Language is not associated with the app.">


upload_apks_with_listing.py の en-USをja-JP にしたら、コミットできた。

    listing_response = service.edits().apklistings().update(
        editId=edit_id, packageName=package_name, language='en-US',
        apkVersionCode=apk_response['versionCode'],
        body={'recentChanges': 'Apk recent changes in en-US'}).execute()

=============================================================================

    listing_response = service.edits().apklistings().update(
        editId=edit_id, packageName=package_name, language='ja-JP',
        apkVersionCode=apk_response['versionCode'],
        body={'recentChanges': 'Apk recent changes in ja-JP'}).execute()

おそらく他のpyファイルも同様だと思う。