Coinbase python APIError:汇款失败

时间:2015-03-28 08:05:37

标签: python bitcoin coinbase-api

我正在尝试整合新的Coinbase python library。我想让send_money工作。但不管我怎么试,它都在说

transaction = account.send_money(address, bitcoins)
File "C:\Python27\lib\site-packages\coinbase\model.py", line 360, in send_money
'Failed to send money')
File "C:\Python27\lib\site-packages\coinbase\error.py", line 58, in build_api_error
raise error
APIError: Failed to send money

我的python代码:

bitcoins = 0.0001
# address = a bitcoin wallet address
client = Client(API_KEY, API_SECRET)
account = client.get_account()
transaction = account.send_money(address, str(bitcoins))

我可以查看余额,因此account正在运作。此外,所有权限都在Coinbase网站的API设置中授予。

1 个答案:

答案 0 :(得分:1)

您可能需要查看错误的response,以了解调用失败的原因。这可能由于各种原因而发生,但错误消息应该告诉您更多。

https://github.com/coinbase/coinbase-python#error-handling

from coinbase.error import CoinbaseError

try:
    transaction = account.send_money(address, bitcoins)
except CoinbaseError as e:
    print e.response.text