-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upload_file return value #82
Comments
Thanks, marking this as a feature enhancement. |
looks like this isn't going anywhere. This actually destroys the viability of using s3transfer manager in any case where there could potentially be more than one version uploaded, as one can't guarantee that the data from a subsequent 'head' call refers to the same file -- since s3 is eventually consistent. That's a pretty bad breakage, rather than just a feature request. |
Does anyone know of a workaround, or do we have to resort to not using |
A few options I've thought of to work around this:
|
I have a workaround for import s3transfer.upload
import s3transfer.tasks
class PutObjectTask(s3transfer.tasks.Task):
# Copied from s3transfer/upload.py, changed to return the result of client.put_object.
def _main(self, client, fileobj, bucket, key, extra_args):
with fileobj as body:
return client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)
class CompleteMultipartUploadTask(s3transfer.tasks.Task):
# Copied from s3transfer/tasks.py, changed to return a result.
def _main(self, client, bucket, key, upload_id, parts, extra_args):
print(f"Multipart upload {upload_id} for {key}.")
return client.complete_multipart_upload(
Bucket=bucket,
Key=key,
UploadId=upload_id,
MultipartUpload={"Parts": parts},
**extra_args,
)
s3transfer.upload.PutObjectTask = PutObjectTask
s3transfer.upload.CompleteMultipartUploadTask = CompleteMultipartUploadTask |
What's the status of this? If we put that monkey patch into a pull request, will that fix the problem? |
Both
PutObject
andCompleteMultipartUpload
respond with data that includes theVersionId
andETag
. [1] [2]It would be really useful if
S3Transfer.upload_file
could return this response, or some part of the response.The text was updated successfully, but these errors were encountered: