azure-servicebus/azure/servicebus/control_client/servicebusservice.py
def _get_token(self, host, path, httpclient):
        '''
        Returns token for the request.

        host:
            the Service Bus service request.
        path:
            the Service Bus service request.
        '''
        wrap_scope = 'http://' + host + path + self.issuer + self.account_key

        # Check whether has unexpired cache, return cached token if it is still
        # usable.
        if wrap_scope in _tokens:
            token = _tokens[wrap_scope]
            if not self._token_is_expired(token):
                return token

        # get token from accessconstrol server
        request = HTTPRequest()
        request.protocol_override = 'https'
        request.host = host.replace('.servicebus.', '-sb.accesscontrol.')
        request.method = 'POST'
        request.path = '/WRAPv0.9'
        request.body = ('wrap_name=' + url_quote(self.issuer) +
                        '&wrap_password=' + url_quote(self.account_key) +
                        '&wrap_scope=' +
                        url_quote('http://' + host + path)).encode('utf-8')
        request.headers.append(('Content-Length', str(len(request.body))))
        resp = httpclient.perform_request(request)

        token = resp.body.decode('utf-8-sig')
        token = url_unquote(token[token.find('=') + 1:token.rfind('&')])
        _tokens[wrap_scope] = token

        return token
def _get_token(self, host, path, httpclient):
        '''
        Returns token for the request.

        host:
            the Service Bus service request.
        path:
            the Service Bus service request.
        '''
        wrap_scope = 'http://' + host + path + self.issuer + self.account_key

        # Check whether has unexpired cache, return cached token if it is still
        # usable.
        if wrap_scope in _tokens:
            token = _tokens[wrap_scope]
            if not self._token_is_expired(token):
                return token

        # get token from accessconstrol server
        request = HTTPRequest()
        request.protocol_override = 'https'
        request.host = host.replace('.servicebus.', '-sb.accesscontrol.')
        request.method = 'POST'
        request.path = '/WRAPv0.9'
        request.body = ('wrap_name=' + url_quote(self.issuer) +
                        '&wrap_password=' + url_quote(self.account_key) +
                        '&wrap_scope=' +
                        url_quote('http://' + host + path)).encode('utf-8')
        request.headers.append(('Content-Length', str(len(request.body))))
        resp = httpclient.perform_request(request)

        token = resp.body.decode('utf-8-sig')
        token = url_unquote(token[token.find('=') + 1:token.rfind('&')])
        _tokens[wrap_scope] = token

        return token
def _get_token ( self , host , path , httpclient ) : wrap_scope = 'http://' + host + path + self . issuer + self . account_key # Check whether has unexpired cache, return cached token if it is still # usable. if wrap_scope in _tokens : token = _tokens [ wrap_scope ] if not self . _token_is_expired ( token ) : return token # get token from accessconstrol server request = HTTPRequest ( ) request . protocol_override = 'https' request . host = host . replace ( '.servicebus.' , '-sb.accesscontrol.' ) request . method = 'POST' request . path = '/WRAPv0.9' request . body = ( 'wrap_name=' + url_quote ( self . issuer ) + '&wrap_password=' + url_quote ( self . account_key ) + '&wrap_scope=' + url_quote ( 'http://' + host + path ) ) . encode ( 'utf-8' ) request . headers . append ( ( 'Content-Length' , str ( len ( request . body ) ) ) ) resp = httpclient . perform_request ( request ) token = resp . body . decode ( 'utf-8-sig' ) token = url_unquote ( token [ token . find ( '=' ) + 1 : token . rfind ( '&' ) ] ) _tokens [ wrap_scope ] = token return token
Returns token for the request.

        host:
            the Service Bus service request.
        path:
            the Service Bus service request.
Returns token for the request .