ericsomdahl / python-bittrex

Python bindings for bittrex
MIT License
585 stars 283 forks source link

need help generating api key using the secret and key #146

Closed maheshj01 closed 4 years ago

maheshj01 commented 6 years ago

@ericsomdahl I need your help Iam not much familiar with How hashing works in python,I just want to fetch my bittrex balance of a specific currency,and as I see on https://bittrex.com/home/api the offcial documentation getbalance is the account api which requires secret and key to access the info,through this url https://bittrex.com/api/v1.1/account/getbalance?apikey=API_KEY&currency=BTC
I think In the url the API_KEY is supposed to be replaced by a hash generated by secret and key so can you please help me generate the API_KEY I woul really appreciate your help. I saw your code but I was not able to understand how the API was generated and what did the variable values contained

[]( from urllib.parse import urlencode import urllib.request import json import time import hmac import hashlib

values={ }
secret='xxxxxxxxxxxxxxxxxxxxx'
key='yyyyyyyyyyyyyyyyyyyyy'
url = 'https://bittrex.com/api/v1.1/account/'
url += 'getbalance' + '?' + urlencode(values)
url += '&apikey=' + key
url += '&nonce=' + str(int(time.time()))
signature = hmac.new(b'key', url, hashlib.sha512).hexdigest()
headers = {'apisign': signature}
print(signature)  #error:unicode objects must be encoded before hashing
 ) 

finally my intention is to get the apikey which I can directly put in the url and get the balance in the form of json

skyl commented 6 years ago

The secret and key you get from the bittrex website.

maheshj01 commented 6 years ago

thank you for the reply, I have the secret and the key I just want to know how can I generate the API. so that I can fetch my balance using the private method getBalance.