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.

demandé il y a un an3060 vues
1 réponse
0
Réponse acceptée

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
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions