Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 5 additions & 7 deletions qcloud_cos/cos_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token
if (Scheme != u'http' and Scheme != u'https'):
raise CosClientError('Scheme can be only set to http/https')
self._scheme = Scheme

# 客户使用全球加速域名时,只会传endpoint不会传region。此时这样endpointCi和region同时为None,就会报错。
if EndpointCi is not None:
# 格式化ci的endpoint 不支持自定义域名的
self._endpoint_ci = format_endpoint(EndpointCi, Region, u'ci.')

# 格式化ci的endpoint 不支持自定义域名的
self._endpoint_ci = format_endpoint(EndpointCi, Region, u'ci.')

# 兼容(SecretId,SecretKey)以及(AccessId,AccessKey)
if (SecretId and SecretKey):
Expand Down Expand Up @@ -1128,7 +1126,7 @@ def restore_object(self, Bucket, Key, RestoreRequest={}, **kwargs):
auth=CosS3Auth(self._conf, Key, params=params),
headers=headers,
params=params)
return rt
return None

def select_object_content(self, Bucket, Key, Expression, ExpressionType, InputSerialization, OutputSerialization,
RequestProgress=None, **kwargs):
Expand Down Expand Up @@ -2400,7 +2398,7 @@ def put_bucket_domain(self, Bucket, DomainConfiguration={}, **kwargs):
auth=CosS3Auth(self._conf, params=params),
headers=headers,
params=params)
return rt
return None

def get_bucket_domain(self, Bucket, **kwargs):
"""获取bucket 自定义域名配置
Expand Down
12 changes: 8 additions & 4 deletions qcloud_cos/cos_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,18 @@ def format_values(data):


def format_endpoint(endpoint, region, module=u'cos.'):
"""格式化终端域名"""
if not endpoint and not region:
# 客户使用全球加速域名时,只会传endpoint不会传region。此时这样endpointCi和region同时为None,就会报错。
if not endpoint and not region and module == u'cos.':
raise CosClientError("Region or Endpoint is required not empty!")
if not endpoint:

"""格式化终端域名"""
if endpoint:
return to_unicode(endpoint)
elif region:
region = format_region(region, module)
return u"{region}.myqcloud.com".format(region=region)
else:
return to_unicode(endpoint)
return None


def format_region(region, module=u'cos.'):
Expand Down
2 changes: 1 addition & 1 deletion qcloud_cos/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '5.1.9.10'
__version__ = '5.1.9.11'
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.9.10',
version='1.9.11',
url='https://www.qcloud.com/',
license='MIT',
author='tiedu, lewzylu, channingliu',
Expand Down
2 changes: 0 additions & 2 deletions ut/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1785,8 +1785,6 @@ def test_sse_c_file():
'Tier': 'Expedited'
}
}, SSECustomerAlgorithm='AES256', SSECustomerKey=ssec_key, SSECustomerKeyMD5=ssec_key_md5)
print(response)
assert(response.status_code == 202)

# 测试大文件高级上传,走多段
gen_file('sdk-sse-c-big.local', 21)
Expand Down