def slmq(self): if self._slmq is None: conninfo = self.conninfo account = os.environ.get("SLMQ_ACCOUNT", conninfo.virtual_host) user = os.environ.get("SL_USERNAME", conninfo.userid) api_key = os.environ.get("SL_API_KEY", conninfo.password) host = os.environ.get("SLMQ_HOST", conninfo.hostname) port = os.environ.get("SLMQ_PORT", conninfo.port) secure = bool(os.environ.get("SLMQ_SECURE", self.transport_options.get("secure")) or True) endpoint = "{0}://{1}{2}".format("https" if secure else "http", host, ":{0}".format(port) if port else "") self._slmq = get_client(account, endpoint=endpoint) self._slmq.authenticate(user, api_key) return self._slmq
def slmq(self): if self._slmq is None: conninfo = self.conninfo account = os.environ.get('SLMQ_ACCOUNT', conninfo.virtual_host) user = os.environ.get('SL_USERNAME', conninfo.userid) api_key = os.environ.get('SL_API_KEY', conninfo.password) host = os.environ.get('SLMQ_HOST', conninfo.hostname) port = os.environ.get('SLMQ_PORT', conninfo.port) secure = bool(os.environ.get( 'SLMQ_SECURE', self.transport_options.get('secure')) or True, ) endpoint = '{0}://{1}{2}'.format( 'https' if secure else 'http', host, ':{0}'.format(port) if port else '', ) self._slmq = get_client(account, endpoint=endpoint) self._slmq.authenticate(user, api_key) return self._slmq
def slmq(self): if self._slmq is None: conninfo = self.conninfo account = os.environ.get('SLMQ_ACCOUNT', conninfo.virtual_host) user = os.environ.get('SL_USERNAME', conninfo.userid) api_key = os.environ.get('SL_API_KEY', conninfo.password) host = os.environ.get('SLMQ_HOST', conninfo.hostname) port = os.environ.get('SLMQ_PORT', conninfo.port) secure = bool(os.environ.get( 'SLMQ_SECURE', self.transport_options.get('secure')) or True, ) endpoint = '{}://{}{}'.format( 'https' if secure else 'http', host, f':{port}' if port else '', ) self._slmq = get_client(account, endpoint=endpoint) self._slmq.authenticate(user, api_key) return self._slmq
def slmq(self): if self._slmq is None: conninfo = self.conninfo account = os.environ.get("SLMQ_ACCOUNT", conninfo.virtual_host) user = os.environ.get("SL_USERNAME", conninfo.userid) api_key = os.environ.get("SL_API_KEY", conninfo.password) host = os.environ.get("SLMQ_HOST", conninfo.hostname) port = os.environ.get("SLMQ_PORT", conninfo.port) secure = bool( os.environ.get("SLMQ_SECURE", self.transport_options.get("secure")) or True, ) endpoint = "{0}://{1}{2}".format( "https" if secure else "http", host, ":{0}".format(port) if port else "", ) self._slmq = get_client(account, endpoint=endpoint) self._slmq.authenticate(user, api_key) return self._slmq
def slmq(self): if self._slmq is None: conninfo = self.conninfo account = os.environ.get('SLMQ_ACCOUNT', conninfo.virtual_host) user = os.environ.get('SL_USERNAME', conninfo.userid) api_key = os.environ.get('SL_API_KEY', conninfo.password) host = os.environ.get('SLMQ_HOST', conninfo.hostname) port = os.environ.get('SLMQ_PORT', conninfo.port) secure = bool(os.environ.get( 'SLMQ_SECURE', self.transport_options.get('secure')) or True) if secure: endpoint = "https://%s" % host else: endpoint = "http://%s" % host if port: endpoint = "%s:%s" % (endpoint, port) self._slmq = get_client(account, endpoint=endpoint) self._slmq.authenticate(user, api_key) return self._slmq
def test_get_client_with_endpoint(self, qc): account = 'account' endpoint = 'endpoint' client = get_client(account, endpoint=endpoint) self.assertEquals(client, qc())
def test_get_client(self, qc): account = 'account' client = get_client(account) self.assertEquals(client, qc())