【发布时间】:2019-05-23 17:23:32
【问题描述】:
blob.upload_from_filename(source) 给出错误
raise exceptions.from_http_status(response.status_code, message, >response=response) google.api_core.exceptions.Forbidden: 403 POST >https://www.googleapis.com/upload/storage/v1/b/bucket1-newsdata->bluetechsoft/o?uploadType=multipart: ('Request failed with status >code', 403, 'Expected one of', )
我是按照python写的google cloud的例子here!
from google.cloud import storage
def upload_blob(bucket, source, des):
client = storage.Client.from_service_account_json('/path')
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket)
blob = bucket.blob(des)
blob.upload_from_filename(source)
我使用 gsutil 上传文件,效果很好。
尝试使用也可以正常工作的 python 脚本列出存储桶名称。
我拥有必要的权限并设置了 GOOGLE_APPLICATION_CREDENTIALS。
【问题讨论】:
标签: python google-cloud-storage