Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetBalance TypeError #5

Open
aadon94 opened this issue Oct 2, 2017 · 1 comment
Open

GetBalance TypeError #5

aadon94 opened this issue Oct 2, 2017 · 1 comment

Comments

@aadon94
Copy link

aadon94 commented Oct 2, 2017

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.

@aadon94
Copy link
Author

aadon94 commented 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant