boto3: Best way to delete object in S3

0

There are several ways to delete single object in s3 bucket using boto3 in Python.

S3.Client.delete_object(), S3.Bucket.delete_objects(), S3.Object.delete(), ...

I don't know how to choose the best way for our code.

Would you please give me information about what features each class has, what is the point in choosing an appropriate method?

Thank you.

preguntada hace un año3059 visualizaciones
1 Respuesta
0
Respuesta aceptada

You should use S3.Client from now on. The AWS Python SDK team does not intend to add new features to the resources interface in boto3. S3.Bucket and S3.Object implement the resources interface.

Would you check the first note in the following document. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html

imiky
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas