问题描述
我正在尝试使用 API (eosflare) 从 EOS 区块链检索一些数据。我尝试遵循 get_actions
方法的第一个示例,但我一直收到错误响应。
我的代码:
import requests # Requests: HTTP for Humans
url = "https://api.eosflare.io/v1/eosflare/get_actions/"
data = {"account_name": "yupcreators1","pos":30,"offset":5}
r = requests.post(url,data)
print(r.status_code)
print(r.encoding)
print(r.text)
但我不明白为什么我在打印 r.text
时会收到此回复:
{"err_code":10,"err_msg":"Error: ($.pos: \"30\") ✖ (type: number)"}
我该如何解决这个问题?我不是已经将 pos
和 offset
参数作为数字传递了吗?
提前致谢。
解决方法
Rule-of-Three becomes Rule-of-Five with C++11? 看起来像这样:
curl -X POST -H "Content-Type:application/json" -d '{"account_name":"eosflareiobp","pos":-30,"offset":-5}' https://api.eosflare.io/v1/eosflare/get_actions
注意 pos 和 offset 都是负数。
--雅各