[英]Python websocket-client
I've got a problem with websocket-client.我遇到了 websocket-client 的问题。 That's my code:
那是我的代码:
import websocket
socket= "wss://stream.binance.com:9443/ws/ethusdt@kline_1m"
def on_open():
print("opened session")
def on_close():
print("closed session")
def on_message():
print("recived message")
ws = websocket.WebsocketApp(socket, on_open=on_open, on_close=on_close, on_message=on_message)
ws.run_forever()
And the output is而 output 是
Traceback (most recent call last):
File "c:\Users\konta\OneDrive\Pulpit\cryptobot\bot.py", line 15, in <module>
ws = websocket.WebsocketApp(socket, on_open=on_open, on_close=on_close, on_message=on_message)
AttributeError: module 'websocket' has no attribute 'WebsocketApp'
Everywhere the ones asking questions were told to uninstall websocket-client and just websocket, but I have tried that on many projects.到处询问问题的人都被告知卸载 websocket-client 和 websocket,但我已经在许多项目中尝试过。 I've even tried downloading and installing wheel from my desktop and I have no clue how to solve it, could you help, or just suggest what can i try?
我什至尝试从我的桌面下载和安装 wheel,但我不知道如何解决它,你能帮忙吗,或者只是建议我可以尝试什么?
instead of代替
ws = websocket.WebsocketApp
replace this line of code by将这行代码替换为
ws = websocket.WebSocketApp(...)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.