How do i include the Python(3.6) Coinbase API CB-VERSION header

1k views Asked by At

As mentioned in the title I am using python v3.6

I'm trying to create a python application using the coinbase API and for my code I have:

import coinbase
coinbase = coinbase.Coinbase.with_api_key('key','key')   #Replacing the 'key's with my associated keys

and when I try to make the function call:

coinbase.get_user()

I get the error:

coinbase.error.CoinbaseAPIException: ('Status Code 404', 404, '{"errors":[{"id":"not_found","message":"Not found"}],"warnings":[{"id":"missing_version","message":"Please supply API version (YYYY-MM-DD) as CB-VERSION header","url":"https://developers.coinbase.com/api#versioning"}]}')

I went to the aforementioned web site and found out about the CB-VERSION header and I have no idea how to implement this, every single way I've tried has failed and led to me getting the same error message.

2

There are 2 answers

2
John Zwinck On

Your problem is that you are using an unofficial, unmaintained, out-of-date and incompatible coinbase package. The latest commit was three years ago:

You'll need to get on board with a newer API, such as the official one:

3
Julian Bici On
from coinbase.wallet.client import Client

client = Client(
    <api_key>,
    <api_secret>,
    api_version='2017-11-28')

That should work