【发布时间】:2023-03-16 16:15:01
【问题描述】:
我尝试使用可恢复上传在 Google Cloud Storage 存储桶中上传视频。 但我总是有同样的错误:(u'Response headers must contain header', u'location')
这是我的代码:
client = _get_storage_client()
bucket = client.bucket(BUCKET_NAME, PROJECT_ID)
blob = bucket.blob(filename)
if 'video' in content_type:
url = blob.create_resumable_upload_session(content_type=content_type, client=client)
stream = io.BytesIO(stream_file.file.read())
upload = ResumableUpload(
upload_url=url,
chunk_size=chunk_size
)
transport = AuthorizedSession(credentials=client._credentials)
# Start using the Resumable Upload
response = upload.initiate(
transport=transport,
content_type=content_type,
stream=stream,
metadata={'name': blob.name}
)
while upload.finished is False:
upload.transmit_next_chunk(transport)
upload.initiate()处出现错误
【问题讨论】:
标签: python google-app-engine google-cloud-platform google-cloud-storage