Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

删除对象demo修改 #15929

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,19 @@ client = CosS3Client(config)

# 删除指定前缀 (prefix)的文件
bucket = 'examplebucket-1250000000'
is_over = False
marker = ''
prefix = 'root/logs'
while not is_over:
while True:
response = client.list_objects(Bucket=bucket, Prefix=prefix, Marker=marker)
if 'Contents' in response:
for content in response['Contents']:
print("delete object: ", content['Key'])
client.delete_object(Bucket=bucket, Key=content['Key'])

if response['IsTruncated'] == 'false':
is_over = True
marker = response['Marker']
if response['IsTruncated'] == 'false':
break

marker = response['NextMarker']
```

#### 全部参数请求示例
Expand Down