0

I've got a problem with 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

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. 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?

1 Answer 1

1

instead of

ws = websocket.WebsocketApp

replace this line of code by

ws = websocket.WebSocketApp(...)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.