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


Python SCSBucket.info方法代码示例

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


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

示例1: test_update_file_meta

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import info [as 别名]
    def test_update_file_meta(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)
          
        canned_acl = 'public-read-write'                #快捷ACL
        metadata = {}                                   #自定义文件属性信息
        metadata['author'] = 'dage'
        metadata['home'] = 'tianjin'
        metadata['age'] = '18'
        mimetype = 'text/plain'
        scs.update_meta(self.object_key, metadata=metadata, acl=canned_acl, mimetype=mimetype)
      
        file_info = scs.info(self.object_key)
        #assert metadata
        self.assertEqual(metadata['author'], file_info['metadata']['author'], 'The response metadata[\'author\'] is not match')
        self.assertEqual(metadata['home'], file_info['metadata']['home'], 'The response metadata[\'home\'] is not match')
        self.assertEqual(metadata['age'], file_info['metadata']['age'], 'The response metadata[\'age\'] is not match')
        #assert content-type
#         print file_info['headers']
#TODO:服务器问题         self.assertEqual(mimetype, file_info['headers']['content-type'], 'The response content-type is not match')
        #acl
        file_aclInfo = scs.acl_info(self.object_key)
        self.assertTrue(ACL.ACL_GROUP_ANONYMOUSE in file_aclInfo['ACL'], 'The acl dose not contains GRPS000000ANONYMOUSE group')
        self.assertTrue(ACL.ACL_READ in file_aclInfo['ACL'][ACL.ACL_GROUP_ANONYMOUSE], 'The acl GRPS000000ANONYMOUSE group hasn\'t read right')
        self.assertTrue(ACL.ACL_WRITE in file_aclInfo['ACL'][ACL.ACL_GROUP_ANONYMOUSE], 'The acl GRPS000000ANONYMOUSE group hasn\'t write right')
开发者ID:SinaCloudStorage,项目名称:SinaStorage-SDK-Python,代码行数:32,代码来源:test.py

示例2: test_put_file_relax

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import info [as 别名]
 def test_put_file_relax(self):
     scs = SCSBucket(self.bucket_name)
     try:
         scs.put_bucket('public-read-write')
     except:
         self.fail('create bucket:%s is failed'%self.bucket_name)
          
     scs.put(self.object_key, 'fileContent...fileContent...fileContent...fileContent...fileContent...')
      
     orign_file_metaResult = scs.meta(self.object_key)
      
     canned_acl = 'public-read-write'                #快捷ACL
     metadata = {}                                   #自定义文件属性信息
     metadata['author'] = 'dage'
     metadata['home'] = 'tianjin'
     metadata['age'] = '18'
     mimetype = 'text/plain'
     scs.put_relax(key=self.object_key+'_relax', sina_sha1=orign_file_metaResult['Content-SHA1'], 
                   s_sina_length=orign_file_metaResult['Size'], acl=canned_acl, 
                   metadata=metadata, mimetype=mimetype)
      
     relax_file_aclInfo = scs.acl_info(self.object_key+'_relax')
     self.assertTrue(ACL.ACL_GROUP_ANONYMOUSE in relax_file_aclInfo['ACL'], 'The acl dose not contains GRPS000000ANONYMOUSE group')
     self.assertTrue(ACL.ACL_READ in relax_file_aclInfo['ACL'][ACL.ACL_GROUP_ANONYMOUSE], 'The acl GRPS000000ANONYMOUSE group hasn\'t read right')
     self.assertTrue(ACL.ACL_WRITE in relax_file_aclInfo['ACL'][ACL.ACL_GROUP_ANONYMOUSE], 'The acl GRPS000000ANONYMOUSE group hasn\'t write right')
      
     relax_file_info = scs.info(self.object_key+'_relax')
     #assert metadata
     self.assertEqual(metadata['author'], relax_file_info['metadata']['author'], 'The response metadata[\'author\'] is not match')
     self.assertEqual(metadata['home'], relax_file_info['metadata']['home'], 'The response metadata[\'home\'] is not match')
     self.assertEqual(metadata['age'], relax_file_info['metadata']['age'], 'The response metadata[\'age\'] is not match')
     #assert content-type
     self.assertEqual(mimetype, relax_file_info['headers']['content-type'], 'The response content-type is not match')
开发者ID:SinaCloudStorage,项目名称:SinaStorage-SDK-Python,代码行数:35,代码来源:test.py

示例3: test_copy_file

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import info [as 别名]
 def test_copy_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)
           
     scs.putFile(self.object_key, self.local_file_name)
       
     canned_acl = 'public-read'                #快捷ACL
     metadata = {}                             #自定义文件属性信息
     metadata['author'] = 'copied'
     metadata['home'] = 'beijing'
     metadata['age'] = '189'
     mimetype = 'text/plain'
     scs.copy(source='/'+self.bucket_name+'/'+self.object_key, 
              key=self.object_key+'_copied', acl=canned_acl, 
              metadata=metadata, mimetype=mimetype)
       
     copied_file_aclInfo = scs.acl_info(self.object_key+'_copied')
     self.assertTrue(ACL.ACL_GROUP_ANONYMOUSE in copied_file_aclInfo['ACL'], 'The acl dose not contains GRPS000000ANONYMOUSE group')
     self.assertTrue(ACL.ACL_READ in copied_file_aclInfo['ACL'][ACL.ACL_GROUP_ANONYMOUSE], 'The acl GRPS000000ANONYMOUSE group hasn\'t read right')
       
     copied_file_info = scs.info(self.object_key+'_copied')
     #assert metadata
     self.assertEqual(metadata['author'], copied_file_info['metadata']['author'], 'The response metadata[\'author\'] is not match')
     self.assertEqual(metadata['home'], copied_file_info['metadata']['home'], 'The response metadata[\'home\'] is not match')
     self.assertEqual(metadata['age'], copied_file_info['metadata']['age'], 'The response metadata[\'age\'] is not match')
     #assert content-type
     self.assertEqual(mimetype, copied_file_info['headers']['content-type'], 'The response content-type is not match')
开发者ID:SinaCloudStorage,项目名称:SinaStorage-SDK-Python,代码行数:32,代码来源:test.py

示例4: test_info_file

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import info [as 别名]
 def test_info_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!!'      #文件内容
     canned_acl = 'public-read-write'                #快捷ACL
     metadata = {}                                   #自定义文件属性信息
     metadata['author'] = 'dage'
     metadata['home'] = 'tianjin'
     metadata['age'] = '18'
     mimetype = 'text/plain'
     scs.put(self.object_key, content, acl=canned_acl, metadata=metadata, mimetype=mimetype)
   
     file_info = scs.info(self.object_key)
     #assert metadata
     self.assertEqual(metadata['author'], file_info['metadata']['author'], 'The response metadata[\'author\'] is not match')
     self.assertEqual(metadata['home'], file_info['metadata']['home'], 'The response metadata[\'home\'] is not match')
     self.assertEqual(metadata['age'], file_info['metadata']['age'], 'The response metadata[\'age\'] is not match')
     #assert content-type
     self.assertEqual(mimetype, file_info['headers']['content-type'], 'The response content-type is not match')
开发者ID:SinaCloudStorage,项目名称:SinaStorage-SDK-Python,代码行数:25,代码来源:test.py

示例5: info_file

# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import info [as 别名]
def info_file():
    s = SCSBucket('test11')
    info = s.info('sss.txt')
    print info['mimetype']
    print info['size']
    print info
开发者ID:SinaCloudStorage,项目名称:SinaStorage-SDK-Python,代码行数:8,代码来源:sample.py


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