源码:

try:
        with open(apk_name, 'rb') as f:
            file = leancloud.File(apk_name, f)
            file.save()
            f.close()
            return file._url
        
    except Exception as e:
        print('Upload apk error:' + str(e))
        sys.exit()

报错信息:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): app-router.leancloud.cn
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): cvkrebrv.api.lncld.net
DEBUG:urllib3.connectionpool:https://cvkrebrv.api.lncld.net:443 "POST /1.1/fileTokens HTTP/1.1" 201 None
Upload apk error:Can't convert 'bytes' object to str implicitly
DEBUG:urllib3.connectionpool:https://app-router.leancloud.cn:443 "GET /2/route?appId=cvKrEbRV55FItUPuHiGlotiv-gzGzoHsz HTTP/1.1" 200 261

我在这里是想用脚本上传更新使用的apk包,另外,这种情境下,需要设置绑定的api域名吗? 没有找到相关文档,因为没有用lean init初始化过,并不是云引擎项目

方便提供下 Python SDK 的版本号,以及 Python 的版本号吗?

你好,SDK版本2.1.10,Python版本3.5.4

你好,升级SDK到2.1.14,问题解决,感谢回复。但是,在写这种小脚本的时候,有使用自己绑定域名的必要吗

一般来说这种小脚本可以不用自定义域名(除非打包成应用分发给大量外部用户使用)。