Skip to content

Instantly share code, notes, and snippets.

@hrchu
Created November 12, 2014 05:13
Show Gist options
  • Save hrchu/ead7b2ee7494de24f74d to your computer and use it in GitHub Desktop.
Save hrchu/ead7b2ee7494de24f74d to your computer and use it in GitHub Desktop.
Complete unfinished multipart upload by boto
import boto
from client import conn
bucket_name = '[YOUR BUCKET NAME]'
object_key = '[YOUR OBJECT KEY]'
upload_id = '[UPLOAD ID], can get it by s3cmd multipart s3://[YOUR BUCKET NAME]'
def main():
bucket = conn.lookup(bucket_name)
complete_part_upload(bucket, object_key, upload_id)
def complete_part_upload(bucket, key_name, id):
mpu = boto.s3.multipart.MultiPartUpload()
mpu.bucket = bucket
mpu.key_name = key_name
mpu.id = id
mpu.complete_upload()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment