def __init__(self, account_name=None, account_key=None, protocol='https', host_base=QUEUE_SERVICE_HOST_BASE, dev_host=DEV_QUEUE_HOST, timeout=DEFAULT_HTTP_TIMEOUT, sas_token=None): ''' account_name: your storage account name, required for all operations. account_key: your storage account key, required for all operations. protocol: Optional. Protocol. Defaults to http. host_base: Optional. Live host base url. Defaults to Azure url. Override this for on-premise. dev_host: Optional. Dev host url. Defaults to localhost. timeout: Optional. Timeout for the http request, in seconds. sas_token: Optional. Token to use to authenticate with shared access signature. ''' super(QueueService, self).__init__( account_name, account_key, protocol, host_base, dev_host, timeout, sas_token) if self.account_key: self.authentication = StorageSharedKeyAuthentication( self.account_name, self.account_key, ) elif self.sas_token: self.authentication = StorageSASAuthentication(self.sas_token) else: raise WindowsAzureError(_ERROR_STORAGE_MISSING_INFO)
def __init__(self, account_name=None, account_key=None, protocol='https', host_base=TABLE_SERVICE_HOST_BASE, dev_host=DEV_TABLE_HOST, timeout=DEFAULT_HTTP_TIMEOUT, sas_token=None, connection_string=None, request_session=None): ''' account_name: your storage account name, required for all operations. account_key: your storage account key, required for all operations. protocol: Optional. Protocol. Defaults to http. host_base: Optional. Live host base url. Defaults to Azure url. Override this for on-premise. dev_host: Optional. Dev host url. Defaults to localhost. timeout: Optional. Timeout for the http request, in seconds. sas_token: Optional. Token to use to authenticate with shared access signature. connection_string: Optional. If specified, the first four parameters (account_name, account_key, protocol, host_base) may be overridden by values specified in the connection_string. The next three parameters (dev_host, timeout, sas_token) cannot be specified with a connection_string. See http://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/ for the connection string format. request_session: Optional. Session object to use for http requests. If this is specified, it replaces the default use of httplib. ''' if connection_string is not None: connection_params = StorageConnectionParameters(connection_string) account_name = connection_params.account_name account_key = connection_params.account_key protocol = connection_params.protocol.lower() host_base = connection_params.host_base_table super(TableService, self).__init__(account_name, account_key, protocol, host_base, dev_host, timeout, sas_token, request_session) if self.account_key: self.authentication = StorageTableSharedKeyAuthentication( self.account_name, self.account_key, ) elif self.sas_token: self.authentication = StorageSASAuthentication(self.sas_token) else: raise WindowsAzureError(_ERROR_STORAGE_MISSING_INFO)