bybit-exchange / pybit

Official Python3 API connector for Bybit's HTTP and WebSockets APIs.
Other
339 stars 113 forks source link

WebSocketTimeoutException #219

Open dmlinke opened 3 weeks ago

dmlinke commented 3 weeks ago

Hey there, I am using the Kline subscribe example (Python) from the quickstart examples: https://github.com/bybit-exchange/pybit/blob/master/examples/websocket_example_quickstart.py

from pybit.unified_trading import WebSocket
from time import sleep

ws = WebSocket(
    testnet=True,
    channel_type="linear",
)

def handle_message(message):
    print(message)

ws.orderbook_stream(50, "BTCUSDT", handle_message)

while True:
    sleep(1)

I get the following error: File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pybit/_websocket_stream.py", line 177, in _connect raise websocket.WebSocketTimeoutException( websocket._exceptions.WebSocketTimeoutException: WebSocket Unified V5 (wss://stream.bybit.com/v5/public/linear) connection failed. Too many connection attempts. pybit will no longer try to reconnect.

Any help on this error would be appreciated. I am on Mac. Python 3.11.5. pybit 5.7.0.

issacnumb commented 1 week ago

Same problem on CentOS