def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
    query = self.omit(params, self.extract_params(path))
    url = ((self.urls['api'][api] + '/') + self.implode_params(path, params))
    if (api == 'public'):
        if query:
            url += ('?' + self.urlencode(query))
    else:
        self.check_required_credentials()
        nonce = self.nonce()
        request = {'type': 'OpenAPI', 'sub': self.apiKey, 'nonce': nonce}
        jwt = self.jwt(request, self.secret)
        headers = {'Authorization': ('Bearer ' + jwt)}
        if (method == 'GET'):
            if query:
                url += ('?' + self.urlencode(query))
        elif (method == 'POST'):
            headers['Content-Type'] = 'application/json'
            body = self.json(query)
    return {'url': url, 'method': method, 'body': body, 'headers': headers}
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
    query = self.omit(params, self.extract_params(path))
    url = ((self.urls['api'][api] + '/') + self.implode_params(path, params))
    if (api == 'public'):
        if query:
            url += ('?' + self.urlencode(query))
    else:
        self.check_required_credentials()
        nonce = self.nonce()
        request = {'type': 'OpenAPI', 'sub': self.apiKey, 'nonce': nonce}
        jwt = self.jwt(request, self.secret)
        headers = {'Authorization': ('Bearer ' + jwt)}
        if (method == 'GET'):
            if query:
                url += ('?' + self.urlencode(query))
        elif (method == 'POST'):
            headers['Content-Type'] = 'application/json'
            body = self.json(query)
    return {'url': url, 'method': method, 'body': body, 'headers': headers}