2

I tried to update my apps as bundle (.aab file) in Huawei App Gallery using Huawei Connect API.

I am facing below error:

Traceback (most recent call last):

  File "/root/HMSPublishingAPI/uploadApk.py", line 222, in <module>

    file_type=file_type)

  File "/root/HMSPublishingAPI/uploadApk.py", line 131, in upload_app

    'fileDestUrl': first_phase.json()['result']['UploadFileRsp']['fileInfoList'][0]['fileDestUlr'],

KeyError: 'UploadFileRsp'

I did not face such error when I tried to upload APK file.

Please help me to fix this issue.

Balaji
  • 47
  • 2

1 Answers1

1

In you error description it shows KeyError: 'UploadFileRsp'

  1. As from your code, it seems you are parsing json with the wrong key. Actual response format for Obtaining the File Upload URL API:

https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agcapi-upload-url-0000001158365047#section1093665

    {
    "ret": {
        "code": 0,
        "msg": "success"
    },
    "uploadUrl": "https://appfile1.hicloud.com/FileServer/uploadFile",
    "chunkUploadUrl": "https://appfile1.hicloud.com/FileServer/chunkUploadFile",
    "authCode": "026008**********7328428"
}

KeyError is caused when the result of "upoadUrl" in wrong while parsing. Please check "fileDescUrl" in your code.

  1. Also ensure the size restriction of the APK, AAB files upload. APK - Up to 4GB AAB - Up to 150MB

Please refer https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agcapi-phased-release-0000001111685204

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
KirubaPradeep
  • 287
  • 1
  • 7