Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import time
- import urllib.request
- import urllib.parse
- import hashlib
- import hmac
- APIkey = b'provert-key'
- secret = b'ceeeecret'
- url = 'https://poloniex.com/tradingApi'
- payload = {
- 'command': 'returnBalances',
- 'nonce': int(time() * 1000),
- }
- paybytes = urllib.parse.urlencode(payload).encode('utf8')
- print(paybytes)
- sign = hmac.new(secret, paybytes, hashlib.sha512).hexdigest()
- print(sign)
- headers = {
- 'Key': APIkey,
- 'Sign': sign,
- }
- req = urllib.request.Request(url, headers=headers, data=paybytes)
- with urllib.request.urlopen(req) as response:
- the_page = response.read()
- print(the_page)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement