boto / boto

For the latest version of boto, see https://github.com/boto/boto3 -- Python interface to Amazon Web Services
http://docs.pythonboto.org/
Other
6.48k stars 2.26k forks source link

Multi object delete Google Cloud Storage #2018

Open Koos85 opened 10 years ago

Koos85 commented 10 years ago

I want to delete multiple GCS keys wih Boto. In it's documentation it suggests that there's a multi-object delete method (delete_keys), however I cannot get it to work.

According to this article it is possible for Amazon S3:

    s3 = boto.connect_s3()
    bucket = s3.get_bucket("basementcoders.logging")
    result = bucket.delete_keys([key.name for key in bucket if key.name[-1] == '6'])
    result.deleted

However when i try the same thing for Google Storage it doesn't work:

    bucket = BotoConnection().get_bucket(bucketName)
    keys = [key for key in bucket]
    print len(keys)
    result = bucket.delete_keys(keys)
    print result.deleted
    print result.errors

Traceback (most recent call last): File "gcsClient.py", line 166, in GcsClient.deleteMultipleObjects('debug_bucket') File "gcsClient.py", line 155, in deleteMultipleObjects result = bucket.delete_keys(keys) File "/usr/local/lib/python2.7/dist-packages/boto/s3/bucket.py", line 583, in delete_keys while delete_keys2(headers): File "/usr/local/lib/python2.7/dist-packages/boto/s3/bucket.py", line 582, in delete_keys2 body) boto.exception.GSResponseError: GSResponseError: 400 Bad Request

danielgtaylor commented 10 years ago

@mfschwartz could you please take a look at this issue?

tushar-thantharate commented 7 years ago

Is this fixed? I am getting same error. TIA