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

ssl_context.wrap_socket() raises exception without meaningful message #22

Open
jake1164 opened this issue Nov 30, 2024 · 2 comments
Open

Comments

@jake1164
Copy link

In the def _get_connected_socket( method inside the if is_ssl the ssl_context.wrap_socket() call will raise an exception without any message making it difficult for downstream users to identify why they are getting an exception.

Recommend catching exception and raising with a more meaningful message to make it easier for downstream users.
Something along the lines of:

        if is_ssl:
            try:
                socket = ssl_context.wrap_socket(socket, server_hostname=host)
            except Exception as error:
                # if error is null / blank raise exception with a more meaningful message)
                if not str(error):
                    raise RuntimeError("ssl_context could not wrap_socket")
                raise error
            connect_host = host
        else:
            connect_host = addr_info[-1][0]
@jake1164
Copy link
Author

It would also be nice to know why ssl_context is throwing as well, but that file is embedded and I have yet to trace it.

I am on a pico w with circuitpython 9.2.1 connecting to
https://swd.weatherflow.com/swd/rest/observations/station/52477?token=redacted this use with requests prior to them switching to using the connection manager.

@jake1164
Copy link
Author

jake1164 commented Dec 2, 2024

Also trying to rule out links between requests and CM so I have tested multiple versions.

Connection Manager 1.1.0 - Requests version 3.2.4 - 3.2.7 & 3.2.8 works.
Connection Manager 1.1.0 - Requests version 3.2.10 Fails (Did not test 3.2.9 - no library changes)
Connection Manager 1.2.0 - Requests 2.2.4 or 3.2.7 Fails.

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