unwitting / bitstampy

Bitstamp API wrapper for Python
MIT License
55 stars 21 forks source link

unicode objects must be encoded #10

Closed vantessel closed 6 years ago

vantessel commented 7 years ago

maybe it's just me but: from bitstampy import api c='999999' k='xXx' s=b'xXx' api.account_balance(c, k, s)

and I get the error: TypeError: Unicode-objects must be encoded before hashing on pyhton 3.4

zlwolf236 commented 7 years ago

I got the same error, have been spending 2 days on this, hope somebody can help. Very much appreciated

zlwolf236 commented 7 years ago

this is solved (clean or not clean). I hardcoded the code in hmac.py with this substitution

def update(self, msg):
    """Update this hashing object with the string msg.
    """

    #Two line below were hardcoded
    msg = bytearray(str(msg), 'utf-8')
    print(type(msg))

    self.inner.update(msg)
unwitting commented 7 years ago

Hi - is there any reason you're using a byte string for the secret key? I have a feeling that might be causing this?