Hi! I'm not sure how to do this, could you clarify? (boto3 0.0.7)
>>> import boto3
>>> s3 = boto3.resource('s3')
>>> bucket = s3.Bucket('ubitricity-backup')
>>> o = bucket.Object('test')
>>> mpu = o.initiate_multipart_upload()
>>> part = mpu.MultipartUploadPart(1)
>>> part.upload('datadatadata')
{u'ETag': '"d41d8cd98f00b204e9800998ecf8427e"', 'ResponseMetadata': {'HTTPStatusCode': 200, 'HostId': 'leCanviHIAh0lS9UursVkiMiyzksNVMAn+jYgyClzp5us8mpCjwB06WEeifjy7LX', 'RequestId': '6C5B491C7D0E7060'}}
>>> mpu.complete()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/boto3/resources/factory.py", line 379, in do_action
response = action(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/boto3/resources/action.py", line 77, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 299, in _api_call
raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidRequest) when calling the CompleteMultipartUpload operation: You must specify at least one part
I understand the MultipartUploadPart is not being added to the MultipartUpload object. But how is it done? I was looking for a method like mpu.add_part() but there is none.
Thank you!
@tgal take a look at the answer in https://github.com/boto/boto3/issues/50#issuecomment-72079954 that shows how you do this with clients. For resources, you need to create the same structure and do something like:
mpu.complete(MultipartUpload=part_info)
We are working on some documentation updates that will describe the input parameter structure as well as the output response structure to make this easier.
@tgal I've gone ahead and added an integration test as part of #62 that should help.
Would certainly be nice if the test contained more than one part.
yes, please update for multiple parts.
Most helpful comment
Would certainly be nice if the test contained more than one part.