def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
    url = ((self.urls['api'] + '/') + path)
    query = self.urlencode(self.keysort(params))
    if (method == 'GET'):
        if params:
            url += ('?' + query)
    if (api == 'private'):
        self.check_required_credentials()
        if (method == 'POST'):
            body = query
        signature = self.hmac(self.encode(query), self.encode(self.secret), hashlib.sha256)
        headers = {'Api-Key': self.apiKey, 'Sign': signature.upper(), 'Content-Type': 'application/x-www-form-urlencoded'}
    return {'url': url, 'method': method, 'body': body, 'headers': headers}
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
    url = ((self.urls['api'] + '/') + path)
    query = self.urlencode(self.keysort(params))
    if (method == 'GET'):
        if params:
            url += ('?' + query)
    if (api == 'private'):
        self.check_required_credentials()
        if (method == 'POST'):
            body = query
        signature = self.hmac(self.encode(query), self.encode(self.secret), hashlib.sha256)
        headers = {'Api-Key': self.apiKey, 'Sign': signature.upper(), 'Content-Type': 'application/x-www-form-urlencoded'}
    return {'url': url, 'method': method, 'body': body, 'headers': headers}