Create a gist now

Instantly share code, notes, and snippets.

anonymous /zaif_get_info
Created Sep 15, 2016

What would you like to do?
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