Created
September 15, 2016 08:25
-
-
Save anonymous/e646d71bf52c3eba513160f42e8298a2 to your computer and use it in GitHub Desktop.
This file contains 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
import requests | |
import urllib | |
import hashlib | |
import hmac | |
import time | |
key = '先ほど取得したkey' | |
secret = '先ほど取得したsecret' | |
trade_url = 'https://api.zaif.jp/tapi' | |
nonce = time.time() | |
method = 'get_info' | |
payload = {'nonce': str(nonce), 'method': method} | |
headers = {'key': key, 'sign': hmac.new(secret, urllib.urlencode(payload), hashlib.sha512).hexdigest()} | |
print requests.post(trade_url, data=urllib.urlencode(payload), headers=headers, timeout=3).json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment