kmadac / bitstamp-python-client

Python package to communicate with bitstamp.net
MIT License
143 stars 70 forks source link

TypeError: Can't convert 'bytes' object to str implicitly #20

Closed guaka closed 6 years ago

guaka commented 7 years ago

'

austin-millan commented 7 years ago

I have authentication problems when using your client, with Python2 and Python3. requests.exceptions.HTTPError: 403 Client Error: Authentication Failed for url: https://www.bitstamp.net/api/v2/balance/btcusd/

kmadac commented 7 years ago

Hi Guys, I just tried python 2.7 and 3.5 in Ubuntu 16.04 and it is working for me. No error has been raised. I tried requests version 2.9.1 and even most recent 2.18.4.

Here is my testing code:

import os
import bitstamp.client

bc = bitstamp.client.Trading(username=os.environ['bs_user'],
                             key=os.environ['bs_key'],
                             secret=os.environ['bs_secret'])
print(bc.account_balance())

I have 3 environment vars where my credentials are set: bs_user, bs_key and bs_secret

kmadac commented 6 years ago

No activity for more than 3 months. Closing the issue. If you still experience the issue, feel free to reopen it. Thanks.

pAulseperformance commented 6 years ago

I know this is closed, but I am running into the same issue. I've tried using python 2.7 and 3.6.4. on Linux Ubuntu 16.04 LTS

import bitstamp.client
import bitstampsettings

trading_client = bitstamp.client.Trading(
    username=bitstampsettings.customer_id, 
    key= bitstampsettings.api_key, 
    secret= bitstampsettings.API_SECRET)
print(trading_client.open_orders())

This is all I have in my bitsampsettings file:

customer_id = "my_id"
API_SECRET = "my_secret"
api_key = "my_key"

HTTPError: 403 Client Error: Authentication Failed for url: https://www.bitstamp.net/api/v2/user_transactions/

austin-millan commented 6 years ago

Hi @GrilledChickenThighs,

The reason I was getting the error was due to my API keys being invalid. If I were you I would re-generate them and see if that fixes it.