当前位置: 首页>>代码示例>>Python>>正文


Python SCSBucket.listdir方法代码示例

本文整理汇总了Python中sinastorage.bucket.SCSBucket.listdir方法的典型用法代码示例。如果您正苦于以下问题:Python SCSBucket.listdir方法的具体用法?Python SCSBucket.listdir怎么用?Python SCSBucket.listdir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sinastorage.bucket.SCSBucket的用法示例。


在下文中一共展示了SCSBucket.listdir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: listFile

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import listdir [as 别名]
def listFile(bucketName):
	Files = []
	s = SCSBucket(bucketName)
	files = s.listdir()
	for i in files:
		#i = (name, isPrefix, sha1, expiration_time, modify, owner, md5, content_type, size)
		Files.append(i)
	return Files
开发者ID:gothack329,项目名称:sirius.py,代码行数:10,代码来源:scs_sync.py

示例2: tearDown

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import listdir [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)
开发者ID:SinaCloudStorage,项目名称:SinaStorage-SDK-Python,代码行数:13,代码来源:test.py

示例3: list_bucket_files

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import listdir [as 别名]
def list_bucket_files():
    s = SCSBucket('test11')
    files_generator = s.listdir()#delimiter='/')
    print '-----list_bucket_files---------'
    print '-----detail---------'
    print ('truncated : %r\n'
    'marker:%r\n'
    'prefix:%r\n'
    'delimiter:%r\n'
    'contents_quantity:%r\n'
    'common_prefixes_quantity:%r\n'
    'next_marker:%r'%(files_generator.truncated, 
                      files_generator.marker,
                      files_generator.prefix,
                      files_generator.delimiter,
                      files_generator.contents_quantity,
                      files_generator.common_prefixes_quantity,
                      files_generator.next_marker))
    print '-----file list---------'
开发者ID:SinaCloudStorage,项目名称:SinaStorage-SDK-Python,代码行数:21,代码来源:sample.py

示例4: test_list_bucket_files

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import listdir [as 别名]
    def test_list_bucket_files(self):
        scs = SCSBucket(self.bucket_name)
        scs.put_bucket()
          
        content = u'this is a file content text!!'
        scs.put(self.object_key,content)
      
        file_gen = scs.listdir()
          
        self.assertTrue(file_gen is not None, 'List bucket files result is None')
        for item in file_gen:
            #(name, isPrefix, sha1, expiration_time, modify, owner, md5, content_type, size)
            self.assertTrue(item[0] is not None, 'file name is None')
            self.assertTrue(item[1] is not None, 'file isPrefix is None')
            self.assertTrue(item[2] is not None, 'file sha1 is None')
#             self.assertIsNotNone(item[3], 'file expiration_time is None')
            self.assertTrue(item[4] is not None, 'file modify is None')
            self.assertTrue(item[5] is not None, 'file owner is None')
            self.assertTrue(item[6] is not None, 'file md5 is None')
            self.assertTrue(item[7] is not None, 'file content_type is None')
            self.assertTrue(item[8] is not None, 'file size is None')
开发者ID:SinaCloudStorage,项目名称:SinaStorage-SDK-Python,代码行数:23,代码来源:test.py


注:本文中的sinastorage.bucket.SCSBucket.listdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。