I'm subscribing to a GraphQL endpoint, using the Python library py-graphql-client. This uses standard Python websocket
. After a day or so, I get the following error:
File "/root/.local/lib/python3.9/site-packages/websocket/_socket.py", line 81, in recv
bytes_ = sock.recv(bufsize)
File "/usr/local/lib/python3.9/ssl.py", line 1227, in recv
return self.read(buflen)
File "/usr/local/lib/python3.9/ssl.py", line 1102, in read
return self._sslobj.read(len)
ConnectionResetError: [Errno 104] Connection reset by peer
In my own code I would add a try/except clause to capture and process the error, but this is from the standard library. How would I go and protect against this error?
try/except
in your code that calls the library function. – Barmar