You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm calling api.getbalance('BTC') but it complains saying:
hmac.py", line 144, in new
return HMAC(key, msg, digestmod)
raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).name)
TypeError: key: expected bytes or bytearray, but got 'str'
I've tried changing 'BTC' to bytes with: x = 'BTC'.encode() and passing that in but same error. Any help would be appreciated.
Found the solution, believe it's an issue with Python 3:
Change signature = hmac.new(self.secret, url, hashlib.sha512).hexdigest()
to signature = hmac.new(self.secret.encode('utf-8'), url.encode('utf-8'), hashlib.sha512).hexdigest()
in the bittrex.py file
Reacted by TotallyKyle, leexxg, espressocannon and Igor A. Melekhine
Activity
aadon94 commentedon Oct 2, 2017
Found the solution, believe it's an issue with Python 3:
Change
signature = hmac.new(self.secret, url, hashlib.sha512).hexdigest()to
signature = hmac.new(self.secret.encode('utf-8'), url.encode('utf-8'), hashlib.sha512).hexdigest()in the bittrex.py file