Created
May 26, 2014 11:34
-
-
Save matee911/615552a8e2c1f6b3a0d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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