def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
    uri = ('/' + self.implode_params(path, params))
    url = (self.urls['api'][api] + uri)
    if (api == 'private'):
        self.check_required_credentials()
        nonce = str(self.nonce())
        auth = None
        headers = {'apikey': self.apiKey, 'timestamp': nonce}
        if (method == 'POST'):
            headers['Content-Type'] = 'application/json'
            auth = (((uri + '\n') + nonce) + '\n')
            body = self.json(params)
            auth += body
        else:
            query = self.keysort(self.omit(params, self.extract_params(path)))
            queryString = ''
            if query:
                queryString = self.urlencode(query)
                url += ('?' + queryString)
                queryString += '\n'
            auth = ((((uri + '\n') + queryString) + nonce) + '\n')
        secret = base64.b64decode(self.secret)
        signature = self.hmac(self.encode(auth), secret, hashlib.sha512, 'base64')
        headers['signature'] = self.decode(signature)
    elif params:
        url += ('?' + self.urlencode(params))
    return {'url': url, 'method': method, 'body': body, 'headers': headers}
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
    uri = ('/' + self.implode_params(path, params))
    url = (self.urls['api'][api] + uri)
    if (api == 'private'):
        self.check_required_credentials()
        nonce = str(self.nonce())
        auth = None
        headers = {'apikey': self.apiKey, 'timestamp': nonce}
        if (method == 'POST'):
            headers['Content-Type'] = 'application/json'
            auth = (((uri + '\n') + nonce) + '\n')
            body = self.json(params)
            auth += body
        else:
            query = self.keysort(self.omit(params, self.extract_params(path)))
            queryString = 
            if query:
                queryString = self.urlencode(query)
                url += ('?' + queryString)
                queryString += '\n'
            auth = ((((uri + '\n') + queryString) + nonce) + '\n')
        secret = base64.b64decode(self.secret)
        signature = self.hmac(self.encode(auth), secret, hashlib.sha512, 'base64')
        headers['signature'] = self.decode(signature)
    elif params:
        url += ('?' + self.urlencode(params))
    return {'url': url, 'method': method, 'body': body, 'headers': headers}