[英]How to return on_message data received from websocket to outside of the class? Using python websocket-client
[英]websocket-client python no data from the binance api
我遇到的问题是 websocket 没有响应,也没有数据传来。 没有任何打印出来的空终端。
我将 python websocket-client 降级为 0.57.0 版本,现在我打印出“关闭”但仍然没有消息进入。
我不知道出了什么问题。 任何线索为什么?
import websocket cc = 'btcusdt' interval = '1m' socket = f'wss://stream.binance.com:9443/ws/{cc}@kline_{interval}' def on_close(ws): print('close') def on_message(ws, message): print('message') print(message) ws = websocket.WebSocketApp( socket, on_message=on_message, on_close=on_close) websocket.enableTrace(True) ws.run_forever()
这对我有用...它打印了您可能在导入问题中遇到的消息,请尝试使用所有软件包重新安装 python,或确保您使用的是正确的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.