Skip to content
Merged
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
6 changes: 5 additions & 1 deletion qcloud_cos/cos_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CosConfig(object):
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, UA=None, Proxies=None, Domain=None, ServiceDomain=None, PoolConnections=10,
PoolMaxSize=10):
PoolMaxSize=10, AllowRedirects=False):
"""初始化,保存用户的信息

:param Appid(string): 用户APPID.
Expand All @@ -63,6 +63,7 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token
:param ServiceDomain(string): 使用自定义的域名来访问cos service
:param PoolConnections(int): 连接池个数
:param PoolMaxSize(int): 连接池中最大连接数
:param AllowRedirects(bool): 是否重定向
"""
self._appid = to_unicode(Appid)
self._token = to_unicode(Token)
Expand All @@ -78,6 +79,7 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token
self._service_domain = ServiceDomain
self._pool_connections = PoolConnections
self._pool_maxsize = PoolMaxSize
self._allow_redirects = AllowRedirects

if self._domain is None:
self._endpoint = format_endpoint(Endpoint, Region)
Expand Down Expand Up @@ -255,6 +257,8 @@ def send_request(self, method, url, bucket, timeout=30, cos_request=True, **kwar
kwargs['data'] = to_bytes(kwargs['data'])
if self._conf._ip is not None and self._conf._scheme == 'https':
kwargs['verify'] = False
if self._conf._allow_redirects is not None:
kwargs['allow_redirects'] = self._conf._allow_redirects
for j in range(self._retry + 1):
try:
if j != 0:
Expand Down