【问题标题】:Having trouble connecting to coinbase api无法连接到 coinbase api
【发布时间】:2021-02-12 08:45:11
【问题描述】:

我遵循了关于 python Coinbase api https://github.com/resy/coinbase_python3 的文档,并在 coinbase_python3 文件夹中的一个文件中创建了这个 python 脚本:

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'])
# 'user1@example.com'

我不知道姓名和电子邮件;我得到这两个错误,我不确定我做错了什么,所以我不知道这是否是我这边的问题。

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'>

【问题讨论】:

    标签: python api api-key coinbase-api


    【解决方案1】:

    我真的不能说具体出了什么问题,但我可以说你使用的是非官方的 python 库,它最后一次更新是 6 年前。我猜它已经年久失修了。 Coinbase 实际上有一个官方的 Python 库(https://github.com/coinbase/coinbase-python),但至少在两年前就被弃用了。你现在最好的选择是直接使用 python 的请求调用 API 端点,而不使用 coinbase 的库之一。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-27
      • 1970-01-01
      • 2016-09-12
      • 2022-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多