简体   繁体   English

websocket-client python 没有来自 binance 的数据 api

[英]websocket-client python no data from the binance api

I had the problem that the websocket didn't respond and there was no data coming.我遇到的问题是 websocket 没有响应,也没有数据传来。 Empty terminal without anything printed out.没有任何打印出来的空终端。

I downgraded the python websocket-client to 0.57.0 version and now I am getting 'close' printed out but still no messages coming in.我将 python websocket-client 降级为 0.57.0 版本,现在我打印出“关闭”但仍然没有消息进入。

I have no idea about what is wrong.我不知道出了什么问题。 Any clue why?任何线索为什么?

 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()

this worked for me... it printed messages you might have in import problem, try reinstalling python with all the packages, or make sure you are using the correct这对我有用...它打印了您可能在导入问题中遇到的消息,请尝试使用所有软件包重新安装 python,或确保您使用的是正确的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM