I am trying to connect to binance websocket API using python. But it fails with this error: [Errno 8] nodename nor servname provided, or not known
import websocket
import sys
import pkg_resources
SOCKET = 'wss://stream.binance.com:9443/ws/ethusdt@kline_1m'
def on_open(ws):
print('opened connection')
def on_close(ws):
print('close connection')
def on_message(ws, message):
print('received message')
def on_error(ws, error):
print(error)
websocket.enableTrace(True)
ws = websocket.WebSocketApp(SOCKET, on_open=on_open, on_close=on_close, on_message=on_message, on_error=on_error)
ws.run_forever()
Anyone has an idea how should I resolve the issue. Are their APIs reliable? Thanks in advance