Skip to content

Commit

Permalink
modify demo
Browse files Browse the repository at this point in the history
  • Loading branch information
tiedu committed Jul 24, 2020
1 parent d9629fb commit 8fe150b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# appid已在配置中移除,请在参数Bucket中带上appid。Bucket由bucketname-appid组成
secret_id = 'AKID15IsskiBQACGbAo6WhgcQbVls7HmuG00' # 替换为用户的secret_id
secret_key = 'csivKvxxrMvSvQpMWHuIz12pThQQlWRW' # 替换为用户的secret_key
region = 'ap-beijing-1' # 替换为用户的region
region = 'ap-beijing' # 替换为用户的region
token = None # 使用临时密钥需要传入Token,默认为空,可不填
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
client = CosS3Client(config)
Expand Down
37 changes: 37 additions & 0 deletions demo/fetch_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding=utf-8
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client
from qcloud_cos import CosServiceError
from qcloud_cos import CosClientError

import sys
import logging


logging.basicConfig(level=logging.INFO, stream=sys.stdout)

# 设置用户属性, 包括secret_id, secret_key, region
# appid已在配置中移除,请在参数Bucket中带上appid。Bucket由bucketname-appid组成
secret_id = '' # 替换为用户的secret_id
secret_key = '' # 替换为用户的secret_key
region = 'ap-beijing' # 替换为用户的region
token = None # 使用临时密钥需要传入Token,默认为空,可不填
scheme = 'http'
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token, Scheme=scheme) # 获取配置对象
client = CosS3Client(config)

test_bucket = 'examplebucket-1250000000'
# 发起拉取任务
response = client.put_async_fetch_task(
Bucket=test_bucket,
FetchTaskConfiguration={
'Url': 'http://examplebucket-1250000000.cos.ap-beijing.myqcloud.com/exampleobject',
'Key': 'exampleobject'
}
)

# 查询拉取任务
response = client.get_async_fetch_task(
Bucket=test_bucket,
TaskId=response['data']['taskid']
)
2 changes: 1 addition & 1 deletion qcloud_cos/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = '5.1.8.1'
__version__ = '5.1.8.2'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def long_description():

setup(
name='cos-python-sdk-v5',
version='1.8.1',
version='1.8.2',
url='https://www.qcloud.com/',
license='MIT',
author='tiedu, lewzylu, channingliu',
Expand Down

0 comments on commit 8fe150b

Please sign in to comment.