Skip to content

Commit bbbb30d

Browse files
authored
Merge pull request #270 from l-iberty/master
update cos demo
2 parents 9565401 + 622478b commit bbbb30d

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

demo/batch_operation_demo.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
# -*- coding=utf-8
2+
3+
'''
4+
此demo演示批处理操作:
5+
1. 删除cos目录
6+
2. 多线程上传本地目录下的文件
7+
3. 批量删除cos对象
8+
4. 移动对象
9+
'''
10+
211
from qcloud_cos import CosConfig
312
from qcloud_cos import CosS3Client
413
from qcloud_cos import CosServiceError
514
from qcloud_cos import CosClientError
15+
from qcloud_cos.cos_exception import CosException
616
from qcloud_cos.cos_threadpool import SimpleThreadPool
717

818
import sys

demo/dir_download_demo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from qcloud_cos import CosS3Client
99
from qcloud_cos.cos_threadpool import SimpleThreadPool
1010

11+
# 演示多线程方式下载COS目录下的文件
12+
1113
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
1214

1315
# 设置用户属性, 包括 secret_id, secret_key, region等。Appid 已在CosConfig中移除,请在参数 Bucket 中带上 Appid。Bucket 由 BucketName-Appid 组成
@@ -22,7 +24,7 @@
2224
client = CosS3Client(config)
2325

2426
# 用户的 bucket 信息
25-
test_bucket = 'chenxi-1253870963'
27+
test_bucket = 'examplebucket-1250000000'
2628
start_prefix = 'data/'
2729
# 对象存储依赖 分隔符 '/' 来模拟目录语义,
2830
# 使用默认的空分隔符可以列出目录下面的所有子节点,实现类似本地目录递归的效果,

demo/fetch_demo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import sys
88
import logging
99

10+
# Fetch接口异步拉取URL资源保存到COS
11+
1012
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
1113

1214
# 设置用户属性, 包括 secret_id, secret_key, region等。Appid 已在CosConfig中移除,请在参数 Bucket 中带上 Appid。Bucket 由 BucketName-Appid 组成

demo/tce_demo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import random
99
import string
1010

11+
# 对SDK基础接口的封装操作
1112

1213
class CosV5PythonSDKTest(object):
1314
def __init__(self, region, appid, secret_id, secret_key, end_point,

0 commit comments

Comments
 (0)