本文整理汇总了Python中sinastorage.bucket.SCSBucket.delete方法的典型用法代码示例。如果您正苦于以下问题:Python SCSBucket.delete方法的具体用法?Python SCSBucket.delete怎么用?Python SCSBucket.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sinastorage.bucket.SCSBucket
的用法示例。
在下文中一共展示了SCSBucket.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import delete [as 别名]
def tearDown(self):
scs = SCSBucket(self.bucket_name)
if scs.exist() :
try:
file_gen = scs.listdir()
for item in file_gen:
if not item[1]:
scs.delete(item[0])
scs.delete_bucket()
except Exception as err:
self.fail('empty bucket failed.Error is %s'%err)
示例2: test_delete_file
# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import delete [as 别名]
def test_delete_file(self):
scs = SCSBucket(self.bucket_name)
try:
scs.put_bucket('public-read-write')
except:
self.fail('create bucket:%s is failed'%self.bucket_name)
content = u'this is a file content text!!'
scs.put(self.object_key, content)
try:
scs.delete(self.object_key)
except:
self.fail('Delete file is failed')
示例3: delete_file
# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import delete [as 别名]
def delete_file():
s = SCSBucket('test11')
s.delete('testpdf.pdf')