[Cloudian # 6] Try deleting the object stored in the bucket with Python (boto3)

Introduction

Cloudian is fully compatible with S3, so it's convenient to use the AWS SDK! Last time tried to display a list of objects in Python (boto3).

This time, I will try to delete the object stored in the bucket of the object storage with Python (boto3).

Delete object stored in bucket / delete_object ()

Use delete_object () to delete the file (object) uploaded to Cloudian.

In the following example, the latest version of the object of the key "10mb.dat" stored in the bucket "pythonbucket1" is deleted.

test.py


import boto3

client = boto3.client(
    's3',
    endpoint_url='https://xxx.yyy.com'
)


#Bucket name:pythonbucket1 object:10mb.Delete dat file
client.delete_object(Bucket='pythonbucket1', Key='10mb.dat')
{'ResponseMetadata': {'RequestId': '9dad3b68-0e30-1dbc-a754-06bdfcde1d5e',
  'HostId': '',
  'HTTPStatusCode': 204,
  'HTTPHeaders': {'date': 'Sun, 13 Dec 2020 22:27:45 GMT',
   'x-amz-request-id': '9dad3b68-0e30-1dbc-a754-06bdfcde1d5e',
   'server': 'CloudianS3'},
  'RetryAttempts': 0}}

Summary

I tried deleting the object in Python (boto3).

Next time, I would like to operate object storage/Cloudian in various ways with Python.

Recommended Posts

[Cloudian # 6] Try deleting the object stored in the bucket with Python (boto3)
[Cloudian # 7] Try deleting the bucket in Python (boto3)
[Cloudian # 5] Try to list the objects stored in the bucket with Python (boto3)
[Cloudian # 2] Try to display the object storage bucket in Python (boto3)
[Cloudian # 9] Try to display the metadata of the object in Python (boto3)
[Cloudian # 1] Try to access object storage with AWS SDK for Python (boto3)
[Cloudian # 10] Try to generate a signed URL for object publishing in Python (boto3)
Try scraping the data of COVID-19 in Tokyo with Python
Try logging in to qiita with Python
Try using the Wunderlist API in Python
Try using the Kraken API in Python
Try working with binary data in Python
Display Python 3 in the browser with MAMP
Try hitting the YouTube API in Python
[Python] Get the files in a folder with Python
Load the network modeled with Rhinoceros in Python ③
Try to solve the man-machine chart with Python
Try using the BitFlyer Ligntning API in Python
[Automation] Extract the table in PDF with Python
Manage AWS nicely with the Python library Boto
Try working with Mongo in Python on Mac
Load the network modeled with Rhinoceros in Python ②
Try implementing the Monte Carlo method in Python
Load the network modeled with Rhinoceros in Python ①
Try using the DropBox Core API in Python
Location information data display in Python --Try plotting with the map display library (folium)-
Try scraping with Python.
Try to solve the programming challenge book with python3
Try translating with Python while maintaining the PDF layout
Try to solve the internship assignment problem with Python
Try touching the micro: bit with VS Code + Python
[Python] Get the numbers in the graph image with OCR
Try implementing associative memory with Hopfield network in Python
Try embedding Python in a C ++ program with pybind11
Crawl the URL contained in the twitter tweet with python
Convert the image in .zip to PDF with Python
Get the result in dict format with Python psycopg2
Write letters in the card illustration with OpenCV python
Object oriented in python
Try gRPC in Python
Try to decipher the login data stored in Firefox
Try 9 slices in Python
Try running python in a Django environment created with pipenv
Try hitting the Twitter API quickly and easily with Python
2020/02 Python 3.7 + TensorFlow 2.1 + Keras 2.3.1 + YOLOv3 Object detection with the latest version
Try Amazon Simple Workflow Service (SWF) with Python and boto3
Try sorting your own objects with priority queue in Python
Calculate the square root of 2 in millions of digits with python
[Homology] Count the number of holes in data with Python
Try to automate the operation of network devices with Python
Image analysis with Object Detection API to try in 1 hour
Try to decipher the garbled attachment file name with Python
Working with LibreOffice in Python
Download the file in Python
Scraping with chromedriver in python
String object methods in Python
Debugging with pdb in Python
Null object comparison in Python
Try Python output with Haxe 3.2
S3 operation with python boto3
Working with sounds in Python