Open hgducharme opened 2 years ago
What happens if the EventStreamWatcher
loses connection while streaming the events? Here's a reference to get started:
https://stackoverflow.com/questions/25860105/python-requests-package-lost-connection-while-streaming
Maybe upon when we establish a Session we can save the session ID or some unique identifier to pass to lichess.com later if the connection is closed, so that we can resume with the same session data as before
Got this exception when attempting to send a challenge
Exception has occurred: ConnectionError
('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
TypeError: getresponse() got an unexpected keyword argument 'buffering'
During handling of the above exception, another exception occurred:
File "<string>", line 3, in raise_from
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
File "<string>", line 3, in raise_from
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
File "/Users/hgd/repos/chessAI/src/lichess/LichessAPI.py", line 88, in create_challenge
response = self.session.post(url, data = request_body)
File "/Users/hgd/repos/chessAI/src/lichess/ChallengeStreamWatcher.py", line 38, in _send_user_challenge
response = self.api.create_challenge(username, settings.CHALLENGE_PARAMS["real_time"])
File "/Users/hgd/repos/chessAI/src/lichess/ChallengeStreamWatcher.py", line 23, in work
self._send_user_challenge()
File "/Users/hgd/repos/chessAI/src/lichess/ContinuousThread.py", line 19, in run
self.work()
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Maybe all get and post commands can be wrapped in a try and except block? We can catch a
ConnectionError
and handle it accordingly.