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
9 changes: 7 additions & 2 deletions qcloud_cos/cos_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CosConfig(object):
"""config类,保存用户相关信息"""
def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token=None, Scheme=None, Timeout=None,
Access_id=None, Access_key=None, Secret_id=None, Secret_key=None,
Endpoint=None, IP=None, Port=None, Anonymous=None):
Endpoint=None, IP=None, Port=None, Anonymous=None, UA=None):
"""初始化,保存用户的信息

:param Appid(string): 用户APPID.
Expand All @@ -49,6 +49,7 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token
:param IP(string): 访问COS的ip
:param Port(int): 访问COS的port
:param Anonymous(bool): 是否使用匿名访问COS
:param UA(string): 使用自定义的UA来访问COS
"""
self._appid = to_unicode(Appid)
self._token = to_unicode(Token)
Expand All @@ -58,6 +59,7 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token
self._ip = to_unicode(IP)
self._port = Port
self._anonymous = Anonymous
self._ua = UA

if Scheme is None:
Scheme = u'https'
Expand Down Expand Up @@ -196,7 +198,10 @@ def send_request(self, method, url, bucket, timeout=30, **kwargs):
"""封装request库发起http请求"""
if self._conf._timeout is not None: # 用户自定义超时时间
timeout = self._conf._timeout
kwargs['headers']['User-Agent'] = 'cos-python-sdk-v' + __version__
if self._conf._ua is not None:
kwargs['headers']['User-Agent'] = self._conf._ua
else:
kwargs['headers']['User-Agent'] = 'cos-python-sdk-v' + __version__
if self._conf._token is not None:
kwargs['headers']['x-cos-security-token'] = self._conf._token
if bucket is not None:
Expand Down
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.6.4'
__version__ = '5.1.6.5'