Replace deprecated ssl.wrap_socket with SSLContext.wrap_socket for Py…#79
Open
carlowahlstedt wants to merge 1 commit into
Open
Replace deprecated ssl.wrap_socket with SSLContext.wrap_socket for Py…#79carlowahlstedt wants to merge 1 commit into
carlowahlstedt wants to merge 1 commit into
Conversation
…thon 3.12+ compatibility
mattdodge
reviewed
Sep 16, 2025
Owner
mattdodge
left a comment
There was a problem hiding this comment.
appreciate you looking into this! DIdn't realize this was failing on 3.12. A little cleanup needed I think but lmk when done and I'll take another look. I can also try to track this down in more detail later this week
| click.echo("Using localhost SSL certificate (HTTPS)") | ||
| server.socket = ssl.wrap_socket( | ||
| context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) | ||
| context.load_cert_chain(certfile=certfile, keyfile=keyfile) |
Owner
There was a problem hiding this comment.
I think certfile needs to be defined somewhere first
Author
There was a problem hiding this comment.
You mean AI got it wrong?! lol. If you find time, go for it. I've been too covered over to even continue on the side pet project I was working on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python 3.12 removes functional support for ssl.wrap_socket, which causes the CLI login flow to fail with:
This PR updates the login server code to use the modern SSLContext.wrap_socket API, maintaining compatibility with Python 3.12+ while preserving behavior for earlier versions.
🔧 Changes
• Replaced ssl.wrap_socket with an SSLContext instance using ssl.PROTOCOL_TLS_SERVER.
• Loads certificate and key as before.
• Wraps the server socket with context.wrap_socket(..., server_side=True).