Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Fix Websocket Error #428

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from io import BytesIO
from http import HTTPStatus
from websocket import create_connection
from websocket._exceptions import WebSocketConnectionClosedException
from PIL import Image

from loguru import logger
Expand Down Expand Up @@ -191,7 +192,11 @@ def get_board(self, access_token_in):
)
)
while True:
msg = ws.recv()
try:
msg = ws.recv()
except WebSocketConnectionClosedException as e:
logger.error(e)
continue
if msg is None:
logger.error("Reddit failed to acknowledge connection_init")
exit()
Expand Down