boto / boto3

AWS SDK for Python

Home Page:https://aws.amazon.com/sdk-for-python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example for MultipartUpload

daveisfera opened this issue · comments

Describe the issue

There doesn't appear to be any documentation for how to use MultipartUpload and it errors out saying that the upload_id doesn't exist when trying to use it.

Here's example code:

from uuid import uuid4

import boto3


s3_resource = boto3.resource("s3")
mpu = resource.MultipartUpload("test_bucket", f"test_mpu.txt", str(uuid4()))
for n in range(4):
    part = mpu.Part(n)
    part.upload(Body=open(f"test_{n}.txt").read())

And here's the error that happens:

NoSuchUpload: An error occurred (NoSuchUpload) when calling the UploadPartCopy operation: The specified upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed.

Links

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/multipartupload/index.html

Hi @daveisfera, thanks for reaching out. You're right that the documentation for the resources page is a bit lacking, but fortunately, it's better documented elsewhere. Here's the client MPU operation, and the S3 customization reference. Both of those should be helpful. Please let me know if you have any other questions.

Those are both using Client rather than Resource and isn't that at least partially deprecated?

Nope! Client is fully supported. Resources aren't deprecated, but they are feature-frozen.

Doh! I had it backwards and Resource is the one that's no longer being developed

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.