def sendMessage(self,body,partition): eventHubHost = "yourstreamservice.servicebus.windows.net" httpclient = _HTTPClient(service_instance=self) sasKeyName = "SendPolicy" sasKeyValue = "your stream service key" authentication = ServiceBusSASAuthentication(sasKeyName,sasKeyValue) request = HTTPRequest() request.method = "POST" request.host = eventHubHost request.protocol_override = "https" request.path = "/youreventhub/publishers/" + partition + "/messages?api-version=2014-05" request.body = body request.headers.append(('Content-Type', 'application/atom+xml;type=entry;charset=utf-8')) authentication.sign_request(request, httpclient) request.headers.append(('Content-Length', str(len(request.body)))) status = 0 try: resp = httpclient.perform_request(request) status = resp.status #print resp except HTTPError as ex: print "oops! error" status = ex.status return status
def __init__(self, subscription_id=None, cert_file=None, host=MANAGEMENT_HOST, request_session=None, timeout=DEFAULT_HTTP_TIMEOUT): self.requestid = None self.subscription_id = subscription_id self.cert_file = cert_file self.host = host self.request_session = request_session self.x_ms_version = X_MS_VERSION self.content_type = 'application/atom+xml;type=entry;charset=utf-8' if not self.cert_file and not request_session: if AZURE_MANAGEMENT_CERTFILE in os.environ: self.cert_file = os.environ[AZURE_MANAGEMENT_CERTFILE] if not self.subscription_id: if AZURE_MANAGEMENT_SUBSCRIPTIONID in os.environ: self.subscription_id = os.environ[ AZURE_MANAGEMENT_SUBSCRIPTIONID] if not self.request_session: if not self.cert_file or not self.subscription_id: raise WindowsAzureError( 'You need to provide subscription id and certificate file') self._httpclient = _HTTPClient(service_instance=self, cert_file=self.cert_file, request_session=self.request_session, timeout=timeout) self._filter = self._httpclient.perform_request
def __init__(self, service_namespace=None, account_key=None, issuer=None, x_ms_version='2011-06-01', host_base=SERVICE_BUS_HOST_BASE): #x_ms_version is not used, but the parameter is kept for backwards compatibility self.requestid = None self.service_namespace = service_namespace self.account_key = account_key self.issuer = issuer self.host_base = host_base #get service namespace, account key and issuer. If they are set when constructing, then use them. #else find them from environment variables. if not service_namespace: if os.environ.has_key(AZURE_SERVICEBUS_NAMESPACE): self.service_namespace = os.environ[AZURE_SERVICEBUS_NAMESPACE] if not account_key: if os.environ.has_key(AZURE_SERVICEBUS_ACCESS_KEY): self.account_key = os.environ[AZURE_SERVICEBUS_ACCESS_KEY] if not issuer: if os.environ.has_key(AZURE_SERVICEBUS_ISSUER): self.issuer = os.environ[AZURE_SERVICEBUS_ISSUER] if not self.service_namespace or not self.account_key or not self.issuer: raise WindowsAzureError('You need to provide servicebus namespace, access key and Issuer') self._httpclient = _HTTPClient(service_instance=self, service_namespace=service_namespace, account_key=account_key, issuer=issuer) self._filter = self._httpclient.perform_request
def __init__(self, subscription_id=None, cert_file=None, host=MANAGEMENT_HOST, request_session=None): self.requestid = None self.subscription_id = subscription_id self.cert_file = cert_file self.host = host self.request_session = request_session self.x_ms_version = X_MS_VERSION self.content_type = 'application/atom+xml;type=entry;charset=utf-8' if not self.cert_file and not request_session: if AZURE_MANAGEMENT_CERTFILE in os.environ: self.cert_file = os.environ[AZURE_MANAGEMENT_CERTFILE] if not self.subscription_id: if AZURE_MANAGEMENT_SUBSCRIPTIONID in os.environ: self.subscription_id = os.environ[ AZURE_MANAGEMENT_SUBSCRIPTIONID] if not self.request_session: if not self.cert_file or not self.subscription_id: raise WindowsAzureError( 'You need to provide subscription id and certificate file') self._httpclient = _HTTPClient( service_instance=self, cert_file=self.cert_file, request_session=self.request_session) self._filter = self._httpclient.perform_request
def sendMessage(self, body, partition): eventHubHost = "arduino-yun.servicebus.windows.net" httpclient = _HTTPClient(service_instance=self) sasKeyName = "arduino-yun-data-write" sasKeyValue = "myTDame7onjdJOLoO8NwowFaPGtEcNfsG4V/iyWE0Kk=" authentication = ServiceBusSASAuthentication(sasKeyName, sasKeyValue) request = HTTPRequest() request.method = "POST" request.host = eventHubHost request.protocol_override = "https" request.path = "/arduino-yun-data/messages?timeout=60&api-version=2014-05" request.body = body request.headers.append(("Content-Type", "application/atom+xml;type=entry;charset=utf-8")) authentication.sign_request(request, httpclient) request.headers.append(("Content-Length", str(len(request.body)))) status = 0 try: resp = httpclient.perform_request(request) status = resp.status except HTTPError as ex: status = ex.status return status
def sendMessage(self, body, partition): authentication = ServiceBusSASAuthentication(sasKeyName, sasKeyValue) httpclient = _HTTPClient(service_instance=self) request = HTTPRequest() request.method = "POST" request.host = eventHubHost request.protocol_override = "https" request.path = "/" + eventHubPath + "/publishers/" + partition + "/messages" request.body = body request.headers.append( ('Content-Type', 'application/atom+xml;type=entry;charset=utf-8')) authentication.sign_request(request, httpclient) request.headers.append(('Content-Length', str(len(request.body)))) status = 0 try: resp = httpclient.perform_request(request) status = resp.status except HTTPError as ex: status = ex.status return status
def sendMessage(self,body,partition): eventHubHost = "myservicebusnamespace.servicebus.windows.net" httpclient = _HTTPClient(service_instance=self) sasKeyName = "SendPolicy" sasKeyValue = "erENqf/5wdWCNEbCA9NsDIRqd5MRKdkii07+wezl/NU=" authentication = ServiceBusSASAuthentication(sasKeyName,sasKeyValue) request = HTTPRequest() request.method = "POST" request.host = eventHubHost request.protocol_override = "https" request.path = "/myhub/publishers/" + partition + "/messages?api-version=2014-05" request.body = body request.headers.append(('Content-Type', 'application/atom+xml;type=entry;charset=utf-8')) authentication.sign_request(request, httpclient) request.headers.append(('Content-Length', str(len(request.body)))) status = 0 try: resp = httpclient.perform_request(request) status = resp.status except HTTPError as ex: status = ex.status return status
def sendMessage(self,body,partition): eventHubHost = self.serviceHubName+".servicebus.windows.net" httpclient = _HTTPClient(service_instance=self) authentication = ServiceBusSASAuthentication(self.sasKeyName,self.sasKeyValue) request = HTTPRequest() request.method = "POST" request.host = eventHubHost request.protocol_override = "https" request.path = "/"+self.eventHubName+"/publishers/" + partition + "/messages?api-version=2014-05" request.body = body request.headers.append(('Content-Type', 'application/json;type=entry;charset=utf-8')) authentication.sign_request(request, httpclient) request.headers.append(('Content-Length', str(len(request.body)))) status = 0 try: resp = httpclient.perform_request(request) status = resp.status except HTTPError as ex: status = ex.status return status
def sendMessage(self,body,partition): eventHubHost = "softwebiot.servicebus.windows.net" httpclient = _HTTPClient(service_instance=self) sasKeyName = "sendrule" sasKeyValue = "wu3y8i2FyDj9SyDbUg4XhaUfF4Jlk/IC31etmHTEtnw=" authentication = ServiceBusSASAuthentication(sasKeyName,sasKeyValue) request = HTTPRequest() request.method = "POST" request.host = eventHubHost request.protocol_override = "https" request.path = "/sensordata/publishers/" + partition + "/messages?api-version=2014-05" request.body = body request.headers.append(('Content-Type', 'application/atom+xml;type=entry;charset=utf-8')) authentication.sign_request(request, httpclient) request.headers.append(('Content-Length', str(len(request.body)))) status = 0 try: resp = httpclient.perform_request(request) status = resp.status except HTTPError as ex: status = ex.status return status
def __init__(self, subscription_id=None, cert_file=None, host=MANAGEMENT_HOST): self.requestid = None self.subscription_id = subscription_id self.cert_file = cert_file self.host = host if not self.cert_file: if os.environ.has_key(AZURE_MANAGEMENT_CERTFILE): self.cert_file = os.environ[AZURE_MANAGEMENT_CERTFILE] if not self.subscription_id: if os.environ.has_key(AZURE_MANAGEMENT_SUBSCRIPTIONID): self.subscription_id = os.environ[ AZURE_MANAGEMENT_SUBSCRIPTIONID] if not self.cert_file or not self.subscription_id: raise WindowsAzureError( 'You need to provide subscription id and certificate file') self._httpclient = _HTTPClient(service_instance=self, cert_file=self.cert_file) self._filter = self._httpclient.perform_request
def __init__(self, subscription_id=None, key_file=None, cert_file=None): self.subscription_id = subscription_id self.key_file = key_file self.cert_file = cert_file self.x_ms_version = x_ms_version self._httpclient = _HTTPClient(service_instance=self, cert_file=self.cert_file, key_file=self.key_file, x_ms_version=self.x_ms_version) self._filter = self._httpclient.perform_request
def __init__(self, service_namespace=None, account_key=None, issuer=None, x_ms_version='2011-06-01', host_base=SERVICE_BUS_HOST_BASE): #x_ms_version is not used, but the parameter is kept for backwards compatibility self.requestid = None self.service_namespace = service_namespace self.account_key = account_key self.issuer = issuer self.host_base = host_base #get service namespace, account key and issuer. If they are set when constructing, then use them. #else find them from environment variables. if not service_namespace: if os.environ.has_key(AZURE_SERVICEBUS_NAMESPACE): self.service_namespace = os.environ[AZURE_SERVICEBUS_NAMESPACE] if not account_key: if os.environ.has_key(AZURE_SERVICEBUS_ACCESS_KEY): self.account_key = os.environ[AZURE_SERVICEBUS_ACCESS_KEY] if not issuer: if os.environ.has_key(AZURE_SERVICEBUS_ISSUER): self.issuer = os.environ[AZURE_SERVICEBUS_ISSUER] if not self.service_namespace or not self.account_key or not self.issuer: raise WindowsAzureError( 'You need to provide servicebus namespace, access key and Issuer' ) self._httpclient = _HTTPClient(service_instance=self, service_namespace=service_namespace, account_key=account_key, issuer=issuer) self._filter = self._httpclient.perform_request
def __init__(self, account_name=None, account_key=None, protocol='https', host_base='', dev_host='', timeout=DEFAULT_HTTP_TIMEOUT): ''' 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. ''' self.account_name = account_name self.account_key = account_key self.requestid = None self.protocol = protocol self.host_base = host_base self.dev_host = dev_host # the app is not run in azure emulator or use default development # storage account and key if app is run in emulator. self.use_local_storage = False # check whether it is run in emulator. if EMULATED in os.environ: self.is_emulated = os.environ[EMULATED].lower() != 'false' else: self.is_emulated = False # get account_name and account key. If they are not set when # constructing, get the account and key from environment variables if # the app is not run in azure emulator or use default development # storage account and key if app is run in emulator. if not self.account_name or not self.account_key: if self.is_emulated: self.account_name = DEV_ACCOUNT_NAME self.account_key = DEV_ACCOUNT_KEY self.protocol = 'http' self.use_local_storage = True else: self.account_name = os.environ.get(AZURE_STORAGE_ACCOUNT) self.account_key = os.environ.get(AZURE_STORAGE_ACCESS_KEY) if not self.account_name or not self.account_key: raise WindowsAzureError(_ERROR_STORAGE_MISSING_INFO) self._httpclient = _HTTPClient( service_instance=self, account_key=self.account_key, account_name=self.account_name, protocol=self.protocol, timeout=timeout) self._batchclient = None self._filter = self._perform_request_worker
def __init__(self, account_name=None, account_key=None, protocol='https', host_base='', dev_host=''): """ 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. """ if account_name is not None: self.account_name = account_name.encode('ascii', 'ignore') else: self.account_name = None if account_key is not None: self.account_key = account_key.encode('ascii', 'ignore') else: self.account_key = None self.requestid = None self.protocol = protocol self.host_base = host_base self.dev_host = dev_host # the app is not run in azure emulator or use default development # storage account and key if app is run in emulator. self.use_local_storage = False # check whether it is run in emulator. if EMULATED in os.environ: if os.environ[EMULATED].lower() == 'false': self.is_emulated = False else: self.is_emulated = True else: self.is_emulated = False # get account_name and account key. If they are not set when constructing, # get the account and key from environment variables if the app is not run # in azure emulator or use default development storage account and key if # app is run in emulator. if not self.account_name or not self.account_key: if self.is_emulated: self.account_name = DEV_ACCOUNT_NAME self.account_key = DEV_ACCOUNT_KEY self.use_local_storage = True else: if AZURE_STORAGE_ACCOUNT in os.environ: self.account_name = os.environ[AZURE_STORAGE_ACCOUNT] if AZURE_STORAGE_ACCESS_KEY in os.environ: self.account_key = os.environ[AZURE_STORAGE_ACCESS_KEY] if not self.account_name or not self.account_key: raise WindowsAzureError(_ERROR_STORAGE_MISSING_INFO) self._httpclient = _HTTPClient( service_instance=self, account_key=self.account_key, account_name=self.account_name, protocol=protocol) self._batchclient = None self._filter = self._perform_request_worker
def __init__(self, account_name=None, account_key=None, protocol='http', host_base='', dev_host=''): if account_name is not None: self.account_name = account_name.encode('ascii', 'ignore') else: self.account_name = None if account_key is not None: self.account_key = account_key.encode('ascii', 'ignore') else: self.account_key = None self.requestid = None self.protocol = protocol self.host_base = host_base self.dev_host = dev_host #the app is not run in azure emulator or use default development #storage account and key if app is run in emulator. self.use_local_storage = False #check whether it is run in emulator. if os.environ.has_key(EMULATED): if os.environ[EMULATED].lower() == 'false': self.is_emulated = False else: self.is_emulated = True else: self.is_emulated = False #get account_name and account key. If they are not set when constructing, #get the account and key from environment variables if the app is not run #in azure emulator or use default development storage account and key if #app is run in emulator. if not self.account_name or not self.account_key: if self.is_emulated: self.account_name = DEV_ACCOUNT_NAME self.account_key = DEV_ACCOUNT_KEY self.use_local_storage = True else: if os.environ.has_key(AZURE_STORAGE_ACCOUNT): self.account_name = os.environ[AZURE_STORAGE_ACCOUNT] if os.environ.has_key(AZURE_STORAGE_ACCESS_KEY): self.account_key = os.environ[AZURE_STORAGE_ACCESS_KEY] if not self.account_name or not self.account_key: raise WindowsAzureError(azure._ERROR_STORAGE_MISSING_INFO) self._httpclient = _HTTPClient(service_instance=self, account_key=self.account_key, account_name=self.account_name, protocol=protocol) self._batchclient = None self._filter = self._perform_request_worker
def __init__(self, account_name=None, account_key=None, protocol='https', host_base='', dev_host=''): ''' 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. ''' self.account_name = account_name self.account_key = account_key self.requestid = None self.protocol = protocol self.host_base = host_base self.dev_host = dev_host # the app is not run in azure emulator or use default development # storage account and key if app is run in emulator. self.use_local_storage = False # check whether it is run in emulator. if EMULATED in os.environ: self.is_emulated = os.environ[EMULATED].lower() != 'false' else: self.is_emulated = False # get account_name and account key. If they are not set when # constructing, get the account and key from environment variables if # the app is not run in azure emulator or use default development # storage account and key if app is run in emulator. if not self.account_name or not self.account_key: if self.is_emulated: self.account_name = DEV_ACCOUNT_NAME self.account_key = DEV_ACCOUNT_KEY self.use_local_storage = True else: self.account_name = os.environ.get(AZURE_STORAGE_ACCOUNT) self.account_key = os.environ.get(AZURE_STORAGE_ACCESS_KEY) if not self.account_name or not self.account_key: raise WindowsAzureError(_ERROR_STORAGE_MISSING_INFO) self._httpclient = _HTTPClient(service_instance=self, account_key=self.account_key, account_name=self.account_name, protocol=protocol) self._batchclient = None self._filter = self._perform_request_worker
def __init__(self, subscription_id=None, cert_file=None, host=MANAGEMENT_HOST): self.requestid = None self.subscription_id = subscription_id self.cert_file = cert_file self.host = host if not self.cert_file: if os.environ.has_key(AZURE_MANAGEMENT_CERTFILE): self.cert_file = os.environ[AZURE_MANAGEMENT_CERTFILE] if not self.subscription_id: if os.environ.has_key(AZURE_MANAGEMENT_SUBSCRIPTIONID): self.subscription_id = os.environ[AZURE_MANAGEMENT_SUBSCRIPTIONID] if not self.cert_file or not self.subscription_id: raise WindowsAzureError('You need to provide subscription id and certificate file') self._httpclient = _HTTPClient(service_instance=self, cert_file=self.cert_file) self._filter = self._httpclient.perform_request
def __init__(self, service_namespace=None, account_key=None, issuer=None, x_ms_version='2011-06-01'): self.requestid = None self.service_namespace = service_namespace self.account_key = account_key self.issuer = issuer #get service namespace, account key and issuer. If they are set when constructing, then use them. #else find them from environment variables. if not service_namespace: if os.environ.has_key(AZURE_SERVICEBUS_NAMESPACE): self.service_namespace = os.environ[AZURE_SERVICEBUS_NAMESPACE] if not account_key: if os.environ.has_key(AZURE_SERVICEBUS_ACCESS_KEY): self.account_key = os.environ[AZURE_SERVICEBUS_ACCESS_KEY] if not issuer: if os.environ.has_key(AZURE_SERVICEBUS_ISSUER): self.issuer = os.environ[AZURE_SERVICEBUS_ISSUER] if not self.service_namespace or not self.account_key or not self.issuer: raise WindowsAzureError('You need to provide servicebus namespace, access key and Issuer') self.x_ms_version = x_ms_version self._httpclient = _HTTPClient(service_instance=self, service_namespace=service_namespace, account_key=account_key, issuer=issuer, x_ms_version=self.x_ms_version) self._filter = self._httpclient.perform_request
def __init__(self, account_name=None, account_key=None, protocol='https', host_base='', dev_host='', timeout=DEFAULT_HTTP_TIMEOUT, sas_token=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. request_session: Optional. Session object to use for http requests. If this is specified, it replaces the default use of httplib. ''' self.account_name = account_name self.account_key = account_key self.requestid = None self.protocol = protocol.lower() self.host_base = host_base self.dev_host = dev_host self.sas_token = sas_token # the app is not run in azure emulator or use default development # storage account and key if app is run in emulator. self.use_local_storage = False # check whether it is run in emulator. if EMULATED in os.environ: self.is_emulated = os.environ[EMULATED].lower() != 'false' else: self.is_emulated = False # get account_name and account key. If they are not set when # constructing, get the account and key from environment variables if # the app is not run in azure emulator or use default development # storage account and key if app is run in emulator. if not self.account_name and not self.account_key: if self.is_emulated: self.account_name = DEV_ACCOUNT_NAME self.account_key = DEV_ACCOUNT_KEY self.protocol = 'http' self.use_local_storage = True else: self.account_name = os.environ.get(AZURE_STORAGE_ACCOUNT) self.account_key = os.environ.get(AZURE_STORAGE_ACCESS_KEY) if not self.account_name: raise WindowsAzureError(_ERROR_STORAGE_MISSING_INFO) self._httpclient = _HTTPClient( service_instance=self, protocol=self.protocol, timeout=timeout, request_session=request_session, ) self._batchclient = None self._filter = self._perform_request_worker
def __init__(self, service_namespace=None, account_key=None, issuer=None, x_ms_version='2011-06-01', host_base=SERVICE_BUS_HOST_BASE, shared_access_key_name=None, shared_access_key_value=None, authentication=None, timeout=DEFAULT_HTTP_TIMEOUT, request_session=None): ''' Initializes the service bus service for a namespace with the specified authentication settings (SAS or ACS). service_namespace: Service bus namespace, required for all operations. If None, the value is set to the AZURE_SERVICEBUS_NAMESPACE env variable. account_key: ACS authentication account key. If None, the value is set to the AZURE_SERVICEBUS_ACCESS_KEY env variable. Note that if both SAS and ACS settings are specified, SAS is used. issuer: ACS authentication issuer. If None, the value is set to the AZURE_SERVICEBUS_ISSUER env variable. Note that if both SAS and ACS settings are specified, SAS is used. x_ms_version: Unused. Kept for backwards compatibility. host_base: Optional. Live host base url. Defaults to Azure url. Override this for on-premise. shared_access_key_name: SAS authentication key name. Note that if both SAS and ACS settings are specified, SAS is used. shared_access_key_value: SAS authentication key value. Note that if both SAS and ACS settings are specified, SAS is used. authentication: Instance of authentication class. If this is specified, then ACS and SAS parameters are ignored. timeout: Optional. Timeout for the http request, in seconds. request_session: Optional. Session object to use for http requests. If this is specified, it replaces the default use of httplib. ''' self.requestid = None self.service_namespace = service_namespace self.host_base = host_base if not self.service_namespace: self.service_namespace = os.environ.get(AZURE_SERVICEBUS_NAMESPACE) if not self.service_namespace: raise WindowsAzureError('You need to provide servicebus namespace') if authentication: self.authentication = authentication else: if not account_key: account_key = os.environ.get(AZURE_SERVICEBUS_ACCESS_KEY) if not issuer: issuer = os.environ.get(AZURE_SERVICEBUS_ISSUER) if shared_access_key_name and shared_access_key_value: self.authentication = ServiceBusSASAuthentication( shared_access_key_name, shared_access_key_value) elif account_key and issuer: self.authentication = ServiceBusWrapTokenAuthentication( account_key, issuer) else: raise WindowsAzureError( 'You need to provide servicebus access key and Issuer OR shared access key and value') self._httpclient = _HTTPClient( service_instance=self, timeout=timeout, request_session=request_session, ) self._filter = self._httpclient.perform_request
def __init__(self, service_namespace=None, account_key=None, issuer=None, x_ms_version='2011-06-01', host_base=SERVICE_BUS_HOST_BASE, shared_access_key_name=None, shared_access_key_value=None, authentication=None, timeout=DEFAULT_HTTP_TIMEOUT, request_session=None): ''' Initializes the service bus service for a namespace with the specified authentication settings (SAS or ACS). service_namespace: Service bus namespace, required for all operations. If None, the value is set to the AZURE_SERVICEBUS_NAMESPACE env variable. account_key: ACS authentication account key. If None, the value is set to the AZURE_SERVICEBUS_ACCESS_KEY env variable. Note that if both SAS and ACS settings are specified, SAS is used. issuer: ACS authentication issuer. If None, the value is set to the AZURE_SERVICEBUS_ISSUER env variable. Note that if both SAS and ACS settings are specified, SAS is used. x_ms_version: Unused. Kept for backwards compatibility. host_base: Optional. Live host base url. Defaults to Azure url. Override this for on-premise. shared_access_key_name: SAS authentication key name. Note that if both SAS and ACS settings are specified, SAS is used. shared_access_key_value: SAS authentication key value. Note that if both SAS and ACS settings are specified, SAS is used. authentication: Instance of authentication class. If this is specified, then ACS and SAS parameters are ignored. timeout: Optional. Timeout for the http request, in seconds. request_session: Optional. Session object to use for http requests. If this is specified, it replaces the default use of httplib. ''' self.requestid = None self.service_namespace = service_namespace self.host_base = host_base if not self.service_namespace: self.service_namespace = os.environ.get(AZURE_SERVICEBUS_NAMESPACE) if not self.service_namespace: raise WindowsAzureError('You need to provide servicebus namespace') if authentication: self.authentication = authentication else: if not account_key: account_key = os.environ.get(AZURE_SERVICEBUS_ACCESS_KEY) if not issuer: issuer = os.environ.get(AZURE_SERVICEBUS_ISSUER) if shared_access_key_name and shared_access_key_value: self.authentication = ServiceBusSASAuthentication( shared_access_key_name, shared_access_key_value) elif account_key and issuer: self.authentication = ServiceBusWrapTokenAuthentication( account_key, issuer) else: raise WindowsAzureError( 'You need to provide servicebus access key and Issuer OR shared access key and value' ) self._httpclient = _HTTPClient( service_instance=self, timeout=timeout, request_session=request_session, ) self._filter = self._httpclient.perform_request