Reputation: 451
I have followed the documentation on the python Coinbase api https://github.com/resy/coinbase_python3 and created this python script in a file within the coinbase_python3 folder:
import coinbase
coinbase_api_key = ""
coinbase_api_secret = ""
coinbase = coinbase.Coinbase.with_api_key(coinbase_api_key, coinbase_api_secret)
user = coinbase.get_user()
print(user['name'])
# 'User One'
print(user['email'])
# '[email protected]'
I do not get the name and email; I get these two errors and I am not sure what I did wrong, so I do not know if it is a problem on my side.
Traceback (most recent call last): File "//anaconda3/lib/python3.7/site-packages/requests/utils.py", line 941, in check_header_validity if not pat.match(value): TypeError: expected string or bytes-like object
"bytes, not %s" % (name, value, type(value))) requests.exceptions.InvalidHeader: Value for header {ACCESS_NONCE: 1613118706094479} must be of type str or bytes, not <class 'int'>
Upvotes: 2
Views: 773
Reputation: 26
I can't really say what's wrong specifically but I can say you're using the unofficial python library which was last updated 6 years ago. I would guess that it's fallen into disrepair. Coinbase actually has an official python library (https://github.com/coinbase/coinbase-python), but it was deprecated at least two years ago. Your best bet now would be to just call the API endpoints directly with python's requests without using one of coinbase's libraries.
Upvotes: 1