diff --git a/demo/demo.py b/demo/demo.py index 31195748..88fe4964 100644 --- a/demo/demo.py +++ b/demo/demo.py @@ -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) diff --git a/demo/fetch_demo.py b/demo/fetch_demo.py new file mode 100644 index 00000000..025ccf6d --- /dev/null +++ b/demo/fetch_demo.py @@ -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'] +) diff --git a/qcloud_cos/version.py b/qcloud_cos/version.py index be46c417..c267e462 100644 --- a/qcloud_cos/version.py +++ b/qcloud_cos/version.py @@ -1,2 +1,2 @@ -__version__ = '5.1.8.1' +__version__ = '5.1.8.2' diff --git a/setup.py b/setup.py index 930d2fae..cb98d87a 100644 --- a/setup.py +++ b/setup.py @@ -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',