Skip to content

Commit 6283561

Browse files
committed
modify uri gen
1 parent 2f307bc commit 6283561

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

qcloud_cos/cos_client.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -215,21 +215,25 @@ def __init__(self, Region, Access_id, Access_key, Appid='', Scheme='http', Token
215215
appid=Appid,
216216
region=Region))
217217

218-
def uri(self, bucket, path=None):
218+
def uri(self, bucket, path=None, scheme=None, region=None):
219219
"""拼接url
220220
221221
:param bucket(string): 存储桶名称.
222222
:param path(string): 请求COS的路径.
223223
:return(string): 请求COS的URL地址.
224224
"""
225225
bucket = format_bucket(bucket, self._appid)
226+
if scheme is None:
227+
scheme = self._scheme
228+
if region is None:
229+
region = self._region
226230
if path:
227231
if path[0] == '/':
228232
path = path[1:]
229233
url = u"{scheme}://{bucket}.{region}.myqcloud.com/{path}".format(
230-
scheme=self._scheme,
234+
scheme=scheme,
231235
bucket=to_unicode(bucket),
232-
region=self._region,
236+
region=region,
233237
path=to_unicode(path)
234238
)
235239
else:

0 commit comments

Comments
 (0)