@@ -44,7 +44,7 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token
44
44
Access_id = None , Access_key = None , Secret_id = None , Secret_key = None , Endpoint = None , IP = None , Port = None ,
45
45
Anonymous = None , UA = None , Proxies = None , Domain = None , ServiceDomain = None , KeepAlive = True , PoolConnections = 10 ,
46
46
PoolMaxSize = 10 , AllowRedirects = False , SignHost = True , EndpointCi = None , EndpointPic = None , EnableOldDomain = True , EnableInternalDomain = True , SignParams = True ,
47
- AutoSwitchDomainOnRetry = True ):
47
+ AutoSwitchDomainOnRetry = False ):
48
48
"""初始化,保存用户的信息
49
49
50
50
:param Appid(string): 用户APPID.
@@ -1635,7 +1635,7 @@ def head_bucket(self, Bucket, **kwargs):
1635
1635
bucket = Bucket ,
1636
1636
auth = CosS3Auth (self ._conf ),
1637
1637
headers = headers )
1638
- return None
1638
+ return rt . headers
1639
1639
1640
1640
def put_bucket_acl (self , Bucket , AccessControlPolicy = {}, ** kwargs ):
1641
1641
"""设置bucket ACL
@@ -2926,7 +2926,7 @@ def get_bucket_inventory(self, Bucket, Id, **kwargs):
2926
2926
return data
2927
2927
2928
2928
def delete_bucket_inventory (self , Bucket , Id , ** kwargs ):
2929
- """删除bucket 回源配置
2929
+ """删除bucket清单规则
2930
2930
2931
2931
:param Bucket(string): 存储桶名称.
2932
2932
:param Id(string): 清单规则名称.
@@ -2957,6 +2957,52 @@ def delete_bucket_inventory(self, Bucket, Id, **kwargs):
2957
2957
params = params )
2958
2958
return None
2959
2959
2960
+ def list_bucket_inventory_configurations (self , Bucket , ContinuationToken = None , ** kwargs ):
2961
+ """列举存储桶清单规则
2962
+
2963
+ :param Bucket(string): 存储桶名称
2964
+ :param ContinuationToken(string): 分页参数, 用以获取下一页信息
2965
+ :param kwargs(dict): 设置请求headers.
2966
+ :return(dict): 存储桶清单规则列表
2967
+
2968
+ .. code-block:: python
2969
+
2970
+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
2971
+ client = CosS3Client(config)
2972
+ # 分页列举bucket清单规则
2973
+ continuation_token = ''
2974
+ while True:
2975
+ resp = client.list_bucket_inventory_configurations(
2976
+ Bucket=bucket,
2977
+ ContinuationToken=continuation_token,
2978
+ )
2979
+ if 'InventoryConfiguration' in resp:
2980
+ for conf in resp['InventoryConfiguration']:
2981
+ id = 'ID-{}'.format(i)
2982
+ if resp['IsTruncated'] == 'true':
2983
+ continuation_token = resp['NextContinuationToken']
2984
+ else:
2985
+ break
2986
+ """
2987
+ headers = mapped (kwargs )
2988
+ params = {'inventory' : '' }
2989
+ if ContinuationToken is not None :
2990
+ params ['continuation-token' ] = ContinuationToken
2991
+ url = self ._conf .uri (bucket = Bucket )
2992
+ logger .info ("list bucket inventory configurations, url={url}, headers={headers}" .format (
2993
+ url = url ,
2994
+ headers = headers ,
2995
+ ))
2996
+ rt = self .send_request (
2997
+ method = 'GET' ,
2998
+ url = url ,
2999
+ bucket = Bucket ,
3000
+ auth = CosS3Auth (self ._conf , params = params ),
3001
+ headers = headers ,
3002
+ params = params )
3003
+ data = xml_to_dict (rt .content )
3004
+ return data
3005
+
2960
3006
def put_object_tagging (self , Bucket , Key , Tagging = {}, ** kwargs ):
2961
3007
"""设置object的标签
2962
3008
0 commit comments