@@ -39,7 +39,7 @@ class CosConfig(object):
3939 def __init__ (self , Appid = None , Region = None , SecretId = None , SecretKey = None , Token = None , Scheme = None , Timeout = None ,
4040 Access_id = None , Access_key = None , Secret_id = None , Secret_key = None , Endpoint = None , IP = None , Port = None ,
4141 Anonymous = None , UA = None , Proxies = None , Domain = None , ServiceDomain = None , PoolConnections = 10 ,
42- PoolMaxSize = 10 ):
42+ PoolMaxSize = 10 , AllowRedirects = False ):
4343 """初始化,保存用户的信息
4444
4545 :param Appid(string): 用户APPID.
@@ -63,6 +63,7 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token
6363 :param ServiceDomain(string): 使用自定义的域名来访问cos service
6464 :param PoolConnections(int): 连接池个数
6565 :param PoolMaxSize(int): 连接池中最大连接数
66+ :param AllowRedirects(bool): 是否重定向
6667 """
6768 self ._appid = to_unicode (Appid )
6869 self ._token = to_unicode (Token )
@@ -78,6 +79,7 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token
7879 self ._service_domain = ServiceDomain
7980 self ._pool_connections = PoolConnections
8081 self ._pool_maxsize = PoolMaxSize
82+ self ._allow_redirects = AllowRedirects
8183
8284 if self ._domain is None :
8385 self ._endpoint = format_endpoint (Endpoint , Region )
@@ -255,6 +257,8 @@ def send_request(self, method, url, bucket, timeout=30, cos_request=True, **kwar
255257 kwargs ['data' ] = to_bytes (kwargs ['data' ])
256258 if self ._conf ._ip is not None and self ._conf ._scheme == 'https' :
257259 kwargs ['verify' ] = False
260+ if self ._conf ._allow_redirects is not None :
261+ kwargs ['allow_redirects' ] = self ._conf ._allow_redirects
258262 for j in range (self ._retry + 1 ):
259263 try :
260264 if j != 0 :
0 commit comments