我如何包含 Python(3.6) Coinbase API CB-VERSION 标头

问题描述 投票:0回答:2

正如标题中提到的,我正在使用 python v3.6

我正在尝试使用 coinbase API 创建一个 python 应用程序,对于我的代码,我有:

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

当我尝试调用函数时:

coinbase.get_user()

我收到错误:

coinbase.error.CoinbaseAPIException: ('状态代码 404', 404, '{"errors":[{"id":"not_found","message":"未找到"}],"warnings":[{" id":"missing_version","message":"请提供 API 版本 (YYYY-MM-DD) 作为 CB-VERSION 标头","url":"https://developers.coinbase.com/api#versioning"} ]}')

我访问了上述网站,发现了 CB-VERSION 标头,但我不知道如何实现它,我尝试过的每一种方法都失败了,并导致我收到相同的错误消息。

python-3.x http-headers coinbase-api
2个回答
1
投票
from coinbase.wallet.client import Client

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

这应该有效


0
投票

您的问题是您使用的是非官方、未维护、过时且不兼容的

coinbase
软件包。最新提交是三年前:

您需要使用较新的 API,例如官方 API:

© www.soinside.com 2019 - 2024. All rights reserved.