首页 > 解决方案 > 无法连接到 bybit websocket(出现错误:[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1076))

问题描述

我正在尝试连接到 websocket api,感兴趣的人可以使用 bybit 的 websocket。我尝试了一切并阅读了我能找到的所有文档,它仍然给我和错误:

[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 警报内部错误 (_ssl.c:1076)

我的代码如下所示:

import websocket

def on_message(ws, message):
    print(message)

def on_error(ws, error):
    print(error)

def on_close(ws):
    print("### closed ###")

def on_open(ws):
    ws.send("{'op': 'subscribe', 'args': ['orderBookL2_25.BTCUSDT']}")

ws = websocket.WebSocketApp(url="wss://stream-testnet.bybit.com/realtime_public",
                            on_message=on_message,
                            on_error=on_error,
                            on_close=on_close,
                            on_open=on_open)
ws.run_forever()

我任何人都知道问题是什么或可能是什么,请告诉我/掌舵我,因为这个,过去两天我一直在用头撞墙。提前致谢 :)

标签: pythonapisslwebsocket

解决方案


推荐阅读