我正试图使用从应用程序引擎启动csv文件导入到云sql,如下所述。
虽然这在本地工作,但在应用程序引擎上运行时会失败
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://sqladmin.googleapis.com/v1/projects/xxxxxx/instances/yyyyyy/import?alt=json
returned "Request had insufficient authentication scopes."
Details: "[{'message': 'Insufficient Permission', 'domain': 'global', 'reason': 'insufficientPermissions'}]">"
如何将作用域添加到我的应用程序引擎标准实例?
解决方案如下:
import google.auth
# next line had wrong scope
SCOPES = ['https://www.googleapis.com/auth/cloud-platform']
credentials, _ = google.auth.default(scopes=SCOPES)