0

我正在尝试使用 delete_objects 删除多个对象。但我收到一个错误。我没有找到有关此问题的任何解决方案。

client = boto3.client("s3", **config)

        response = client.delete_objects(
                    Bucket=BUCKET,
                    Delete={
                        'Objects': [
                            {
                                'Key': 'asdasd1.png',
                            },
                            {
                                'Key': 'asdasd1.png',
                            }
                        ]
                    },
                    RequestPayer='requester'
                )

我收到这样的错误:

An error occurred (NotImplemented) when calling the DeleteObjects operation: Unknown
INFO:     127.0.0.1:46958 - "DELETE /image/ HTTP/1.1" 500 Internal Server Error
4

1 回答 1

0

maybe this can help you, it's another way to do it

def cleanup_from_s3(bucket, remote_path):
    s3_contents = list_s3(bucket, remote_path)

    if s3_contents == []:
        return

    for s3_content in s3_contents:
        filename = s3_content["Key"]

        s3_client.delete_object(Bucket=bucket, Key="{0}/{1}".format(remote_path, filename))    
于 2020-11-06T22:13:32.713 回答