How to use the azure-storage-common.azure.storage.common._constants.DEV_ACCOUNT_NAME function in azure-storage-common

To help you get started, we’ve selected a few azure-storage-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-storage-python / azure-storage-common / azure / storage / common / _connection.py View on Github external
def __init__(self, service, account_name=None, account_key=None, sas_token=None, token_credential=None,
                 is_emulated=False, protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE, 
                 custom_domain=None, custom_domain_secondary=None):

        self.account_name = account_name
        self.account_key = account_key
        self.sas_token = sas_token
        self.token_credential = token_credential
        self.protocol = protocol or DEFAULT_PROTOCOL
        self.is_emulated = is_emulated

        if is_emulated:
            self.account_name = DEV_ACCOUNT_NAME
            self.protocol = 'http'

            # Only set the account key if a sas_token is not present to allow sas to be used with the emulator
            self.account_key = DEV_ACCOUNT_KEY if not self.sas_token else None
            emulator_endpoint = _EMULATOR_ENDPOINTS[service] if custom_domain is None else custom_domain

            self.primary_endpoint = '{}/{}'.format(emulator_endpoint, DEV_ACCOUNT_NAME)
            self.secondary_endpoint = '{}/{}'.format(emulator_endpoint, DEV_ACCOUNT_SECONDARY_NAME)
        else:
            # Strip whitespace from the key
            if self.account_key:
                self.account_key = self.account_key.strip()

            endpoint_suffix = endpoint_suffix or SERVICE_HOST_BASE

            # Setup the primary endpoint
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / _connection.py View on Github external
self.account_name = account_name
        self.account_key = account_key
        self.sas_token = sas_token
        self.token_credential = token_credential
        self.protocol = protocol or DEFAULT_PROTOCOL
        self.is_emulated = is_emulated

        if is_emulated:
            self.account_name = DEV_ACCOUNT_NAME
            self.protocol = 'http'

            # Only set the account key if a sas_token is not present to allow sas to be used with the emulator
            self.account_key = DEV_ACCOUNT_KEY if not self.sas_token else None
            emulator_endpoint = _EMULATOR_ENDPOINTS[service] if custom_domain is None else custom_domain

            self.primary_endpoint = '{}/{}'.format(emulator_endpoint, DEV_ACCOUNT_NAME)
            self.secondary_endpoint = '{}/{}'.format(emulator_endpoint, DEV_ACCOUNT_SECONDARY_NAME)
        else:
            # Strip whitespace from the key
            if self.account_key:
                self.account_key = self.account_key.strip()

            endpoint_suffix = endpoint_suffix or SERVICE_HOST_BASE

            # Setup the primary endpoint
            if custom_domain:
                parsed_url = urlparse(custom_domain)

                # Trim any trailing slashes from the path
                path = parsed_url.path.rstrip('/')

                self.primary_endpoint = parsed_url.netloc + path

azure-storage-common

Microsoft Azure Storage Common Client Library for Python

MIT
Latest version published 5 years ago

Package Health Score

76 / 100
Full package analysis

Similar packages