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


Python CloudStorageAccount.create_blob_service方法代码示例

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


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

示例1: test_create_blob_service_empty_credentials

# 需要导入模块: from azure.storage import CloudStorageAccount [as 别名]
# 或者: from azure.storage.CloudStorageAccount import create_blob_service [as 别名]
    def test_create_blob_service_empty_credentials(self):
        # Arrange

        # Act
        bad_account = CloudStorageAccount('', '')
        with self.assertRaises(WindowsAzureError):
            service = bad_account.create_blob_service()
开发者ID:uschen,项目名称:azure-sdk-for-python,代码行数:9,代码来源:test_cloudstorageaccount.py

示例2: get_storage_account_details

# 需要导入模块: from azure.storage import CloudStorageAccount [as 别名]
# 或者: from azure.storage.CloudStorageAccount import create_blob_service [as 别名]
def get_storage_account_details(creds, resource_group_name, account_name):
    storage_client = StorageManagementClient(creds)
    account_result = storage_client.storage_accounts.get_properties(resource_group_name, account_name)
    keys_result = storage_client.storage_accounts.list_keys(resource_group_name, account_name)
    account_key = keys_result.storage_account_keys.key1

    account = CloudStorageAccount(account_name, account_key)
    blob_service = account.create_blob_service()
    file_service = account.create_file_service()
    queue_service = account.create_queue_service()
    table_service = account.create_table_service()

    model = StorageAccountDetails()
    model.account_props = account_result.storage_account
    model.account_keys = keys_result.storage_account_keys
    model.blob_containers = blob_service.iterate_containers()
    model.queues = queue_service.iterate_queues()
    # TODO: find out why listing shares doesn't work
    # model.shares = file_service.iterate_shares()
    model.shares = []
    model.tables = table_service.iterate_tables()
    model.blob_service_properties = blob_service.get_blob_service_properties()
    model.queue_service_properties = queue_service.get_queue_service_properties()
    model.table_service_properties = table_service.get_table_service_properties()

    return model
开发者ID:yunjing,项目名称:azure-sdk-for-python,代码行数:28,代码来源:models.py

示例3: CloudStorageAccountTest

# 需要导入模块: from azure.storage import CloudStorageAccount [as 别名]
# 或者: from azure.storage.CloudStorageAccount import create_blob_service [as 别名]
class CloudStorageAccountTest(AzureTestCase):

    def setUp(self):
        self.account = CloudStorageAccount(
            account_name=credentials.getStorageServicesName(),
            account_key=credentials.getStorageServicesKey())

    #--Test cases --------------------------------------------------------
    def test_create_blob_service(self):
        # Arrange

        # Act
        service = self.account.create_blob_service()

        # Assert
        self.assertIsNotNone(service)
        self.assertIsInstance(service, BlobService)
        self.assertEqual(service.account_name,
                         credentials.getStorageServicesName())
        self.assertEqual(service.account_key,
                         credentials.getStorageServicesKey())

    def test_create_blob_service_empty_credentials(self):
        # Arrange

        # Act
        bad_account = CloudStorageAccount('', '')
        with self.assertRaises(WindowsAzureError):
            service = bad_account.create_blob_service()

        # Assert

    def test_create_table_service(self):
        # Arrange

        # Act
        service = self.account.create_table_service()

        # Assert
        self.assertIsNotNone(service)
        self.assertIsInstance(service, TableService)
        self.assertEqual(service.account_name,
                         credentials.getStorageServicesName())
        self.assertEqual(service.account_key,
                         credentials.getStorageServicesKey())

    def test_create_queue_service(self):
        # Arrange

        # Act
        service = self.account.create_queue_service()

        # Assert
        self.assertIsNotNone(service)
        self.assertIsInstance(service, QueueService)
        self.assertEqual(service.account_name,
                         credentials.getStorageServicesName())
        self.assertEqual(service.account_key,
                         credentials.getStorageServicesKey())
开发者ID:Albert-B-P,项目名称:azure-sdk-for-python,代码行数:61,代码来源:test_cloudstorageaccount.py

示例4: StorageAccountTest

# 需要导入模块: from azure.storage import CloudStorageAccount [as 别名]
# 或者: from azure.storage.CloudStorageAccount import create_blob_service [as 别名]
class StorageAccountTest(ExtendedTestCase):

    def setUp(self):
        self.account_name = 'storagename'
        self.account_key = 'NzhL3hKZbJBuJ2484dPTR+xF30kYaWSSCbs2BzLgVVI1woqeST/1IgqaLm6QAOTxtGvxctSNbIR/1hW8yH+bJg=='
        self.account = CloudStorageAccount(self.account_name, self.account_key)

    #--Test cases --------------------------------------------------------
    def test_create_blob_service(self):
        # Arrange

        # Act
        service = self.account.create_blob_service()

        # Assert
        self.assertIsNotNone(service)
        self.assertIsInstance(service, BlobService)
        self.assertEqual(service.account_name, self.account_name)
        self.assertEqual(service.account_key, self.account_key)

    def test_create_blob_service_empty_credentials(self):
        # Arrange

        # Act
        bad_account = CloudStorageAccount('', '')
        with self.assertRaises(ValueError):
            service = bad_account.create_blob_service()

        # Assert

    def test_create_table_service(self):
        # Arrange

        # Act
        service = self.account.create_table_service()

        # Assert
        self.assertIsNotNone(service)
        self.assertIsInstance(service, TableService)
        self.assertEqual(service.account_name, self.account_name)
        self.assertEqual(service.account_key, self.account_key)

    def test_create_queue_service(self):
        # Arrange

        # Act
        service = self.account.create_queue_service()

        # Assert
        self.assertIsNotNone(service)
        self.assertIsInstance(service, QueueService)
        self.assertEqual(service.account_name, self.account_name)
        self.assertEqual(service.account_key, self.account_key)
开发者ID:huguesv,项目名称:azure-storage-python,代码行数:55,代码来源:test_storage_account.py

示例5: CloudStorageAccount

# 需要导入模块: from azure.storage import CloudStorageAccount [as 别名]
# 或者: from azure.storage.CloudStorageAccount import create_blob_service [as 别名]
#
# The CloudStorageAccount provides factory methods for the queue, table, and
# blob services.
#
# See http://go.microsoft.com/fwlink/?linkid=246933 for Storage documentation.
#
STORAGE_ACCOUNT_NAME = '__paste_your_storage_account_name_here__'
STORAGE_ACCOUNT_KEY = '__paste_your_storage_key_here__'

if os.environ.get('EMULATED', '').lower() == 'true':
    # Running in the emulator, so use the development storage account
    storage_account = CloudStorageAccount(None, None)
else:
    storage_account = CloudStorageAccount(STORAGE_ACCOUNT_NAME, STORAGE_ACCOUNT_KEY)

blob_service = storage_account.create_blob_service()
table_service = storage_account.create_table_service()
queue_service = storage_account.create_queue_service()

#
# Service Bus is a messaging solution for applications. It sits between
# components of your applications and enables them to exchange messages in a
# loosely coupled way for improved scale and resiliency.
#
# See http://go.microsoft.com/fwlink/?linkid=246934 for Service Bus documentation.
#
SERVICE_BUS_NAMESPACE = '__paste_your_service_bus_namespace_here__'
SERVICE_BUS_KEY = '__paste_your_service_bus_key_here__'
bus_service = ServiceBusService(SERVICE_BUS_NAMESPACE, SERVICE_BUS_KEY, issuer='owner')

开发者ID:cnavasca59,项目名称:VirtualWardrobeStylistv2,代码行数:31,代码来源:worker.py


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