Skip to content

Instantly share code, notes, and snippets.

@matee911
Created May 26, 2014 11:34
Show Gist options
  • Save matee911/615552a8e2c1f6b3a0d8 to your computer and use it in GitHub Desktop.
Save matee911/615552a8e2c1f6b3a0d8 to your computer and use it in GitHub Desktop.
url = BASE_URL + method
payload = {'nonce': get_nonce()}
payload.update(kwargs)
post_data = urllib.urlencode(payload)
sign = hmac.new(
SECRET.decode('base64'),
post_data,
hashlib.sha512).digest()
headers = {
'Rest-Key': KEY,
'Rest-Sign': sign.encode('base64').strip().replace('\n', ''),
'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
'Content-type': 'application/x-www-form-urlencoded'
}
response = requests.post(url, data=payload, headers=headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment