我可以看到将文件上传到Google云端存储的a sample。但是,我找不到删除云存储中的文件的示例。是否存在删除文件API?
答案 0 :(得分:1)
以下是JSON API的删除API文档:https://cloud.google.com/storage/docs/json_api/v1/objects/delete
答案 1 :(得分:0)
def delete_blob(bucket_name, destination_blob_name):
"""Deletes a blob from the bucket."""
try:
storage_client = storage.Client(project = project)
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob(destination_blob_name)
blob.delete()
log.info('Blob {} deleted.'.format(destination_blob_name))
except Exception as e:
pass