我是一名业余编码者,正在进行一个周末项目。
我希望访问此处提供的公共API:https://api.coinsecure.in/ 它为我们提供了比特币交易数据-该API通过Websockets提供,而我对此不熟悉。
Websocket URI是wss://coinsecure.in/websocket 我想要测试的方法是:{"method": "recentbuytrades"}
我能够使用Python中列出的“websocket-client”访问WebScocket API,网址为:https://pypi.python.org/pypi/websocket-client/
但不幸的是,我无法弄清楚如何检索特定方法的数据- {"method": "recentbuytrades"}
如果您能提供有关提取此特定方法数据的任何指导,我将非常感激。
最好的祝福, Ryan
[编辑] 我当前使用的代码是:
from websocket import create_connection
ws = create_connection("wss://coinsecure.in/websocket")
result = ws.recv()
print ("Received '%s'" % result)
ws.close()