def sign(self, path, api='current', method='GET', params={}, headers=None, body=None):
    url = self.urls['api'][api]
    if (api != 'www'):
        url += ((('/' + api) + '/') + self.implode_params(path, params))
    query = self.omit(params, self.extract_params(path))
    if (api == 'current'):
        if query:
            url += ('?' + self.urlencode(query))
    elif (api == 'user'):
        self.check_required_credentials()
        nonce = self.nonce()
        request = self.extend({'token': self.apiKey, 'nonce': nonce}, query)
        auth = ((str(nonce) + '$') + self.apiKey)
        request['signature'] = self.hmac(self.encode(auth), self.encode(self.secret))
        body = self.json(request)
        headers = {'Content-Type': 'application/json'}
    return {'url': url, 'method': method, 'body': body, 'headers': headers}
def sign(self, path, api='current', method='GET', params={}, headers=None, body=None):
    url = self.urls['api'][api]
    if (api != 'www'):
        url += ((('/' + api) + '/') + self.implode_params(path, params))
    query = self.omit(params, self.extract_params(path))
    if (api == 'current'):
        if query:
            url += ('?' + self.urlencode(query))
    elif (api == 'user'):
        self.check_required_credentials()
        nonce = self.nonce()
        request = self.extend({'token': self.apiKey, 'nonce': nonce}, query)
        auth = ((str(nonce) + '$') + self.apiKey)
        request['signature'] = self.hmac(self.encode(auth), self.encode(self.secret))
        body = self.json(request)
        headers = {'Content-Type': 'application/json'}
    return {'url': url, 'method': method, 'body': body, 'headers': headers}