@@ -110,13 +110,13 @@ def put_bucket_acl(self, bucket_name, acl):
110110 Bucket = bucket_name + '-' + self .appid , ACL = acl )
111111 return 0
112112
113- def put_bucket_acl_with_GrantFullControl (self , bucket_bane , owner_uin ,
113+ def put_bucket_acl_with_GrantFullControl (self , bucket_name , owner_uin ,
114114 sub_uin ):
115115 # 设置存储桶访问控制权限 GrantFullControl
116116 grant_full_control = 'id="qcs::cam::uin/%s:uin/%s"' % (owner_uin ,
117117 sub_uin )
118118 self .client .put_bucket_acl (
119- Bucket = bucket_bane + '-' + self .appid ,
119+ Bucket = bucket_name + '-' + self .appid ,
120120 GrantFullControl = grant_full_control )
121121
122122 def put_bucket_acl_with_GrantRead (self , bucket_name , owner_uin , sub_uin ):
@@ -235,12 +235,12 @@ def delete_objects(self, bucket_name, obj_list):
235235 Bucket = bucket_name + '-' + self .appid , Delete = delete )
236236 return resp
237237
238- def delete_objects_with_quite (self , bucket_name , obj_list , quite ):
238+ def delete_objects_with_quite (self , bucket_name , obj_list , quiet ):
239239 # 批量删除对象
240240 _obj = []
241241 for obj in obj_list :
242242 _obj .append ({"Key" : obj })
243- delete = {"Object" : _obj , "Quiet" : quite }
243+ delete = {"Object" : _obj , "Quiet" : quiet }
244244 resp = self .client .delete_objects (
245245 Bucket = bucket_name + '-' + self .appid , Delete = delete )
246246 return resp
@@ -311,7 +311,7 @@ def put_object_acl_with_GrantWrite(self, bucket_name, obj_name, owner_uin,
311311 self .client .put_object_acl (
312312 Bucket = bucket_name + '-' + self .appid ,
313313 Key = obj_name ,
314- GrantRead = grant_write )
314+ GrantWrite = grant_write )
315315
316316 def get_object_acl (self , bucket_name , obj_name ):
317317 # 获取对象访问控制权限
@@ -381,11 +381,11 @@ def upload_file(self, bucket_name, obj_name, file_path):
381381if __name__ == "__main__" :
382382
383383 main = CosV5PythonSDKTest (
384- region = "wh " ,
384+ region = "" ,
385385 appid = "" ,
386386 secret_id = "" ,
387387 secret_key = "" ,
388- end_point = "cos.%s.yun.ccb.com " ,
388+ end_point = "" ,
389389 scheme = "http" )
390390
391391 try :
@@ -416,7 +416,7 @@ def upload_file(self, bucket_name, obj_name, file_path):
416416
417417 # head存储桶(查询存储桶是否存在)
418418 main .head_bucket (bucket_name = "mainbkt" )
419- main .head_bucket (bucket_name = "not_exist " )
419+ main .head_bucket (bucket_name = "notexist " )
420420
421421 # 获取bucket地域信息
422422 resp = main .get_bucket_location (bucket_name = "mainbkt" )
@@ -492,7 +492,7 @@ def upload_file(self, bucket_name, obj_name, file_path):
492492 # 下载不存在对象
493493 main .get_object (
494494 bucket_name = "mainbkt" ,
495- obj_name = "not_exist .txt" ,
495+ obj_name = "notexist .txt" ,
496496 file_name = "f:\\ x.txt" )
497497
498498 # 删除对象
@@ -602,11 +602,8 @@ def upload_file(self, bucket_name, obj_name, file_path):
602602 obj_name = "upload1g.txt" ,
603603 file_path = "f:\\ test1g.txt" )
604604
605- print "Success"
605+ print ( "Succeeded" )
606606
607- except CosServiceError as e :
608- print (e .get_origin_msg ())
609- print (e .get_digest_msg ())
610- print (e .get_status_code ())
611- print (e .get_error_code ())
612- print (e .get_error_msg ())
607+ except Exception as e :
608+
609+ print ("Failed" )
0 commit comments