Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.timeout: _ssl.c:1112: The handshake operation timed out not captured in except Exception #282

Open
alverelt opened this issue Nov 27, 2023 · 0 comments

Comments

@alverelt
Copy link

This happened once when i instantiated SpotWebsocketStreamClient, it raised that was never captured, i will show the code:

def _load_websocket_client(self):
        stream_url_1 = 'wss://stream.binance.com:9443'
        stream_url_2 = 'wss://stream.binance.com:443'
        c = 0
        max_retries = 4
        while True:
            try:
                if c in [0, 2]:
                    stream_url = stream_url_1
                else:
                    stream_url = stream_url_2

                // some logging

                self.stream_client = SpotWebsocketStreamClient(
                    stream_url=stream_url,
                    on_message=self.message_handler,
                    on_error=self.error_handler,
                    on_close=self.close_handler
                )

                break
            except Exception:
                human_show_and_save({
                    'msg': f'Try {c+1} of {max_retries} failed instatiaing websocket.'
                })

                if c >= max_retries:
                    raise

                c += 1 

It should have been captured in the except Exception but it didn't.

Environment

  • binance-connector==3.3.0
  • Python version: 3.9
  • Operating system: Ubuntu 22.04.3 LTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant