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

Fix for Python 3.12 (ssl.wrap_socket got removed) #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fabiant7t
Copy link

ssl.wrap_socket is not available on Python 3.12+:

  File "/some/where/hetzner/util/http.py", line 66, in connect
    self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
                ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

The new approach is creating a SSL context and use it to wrap the socket. For backwards compatibility, this is only used when ssl.wrap_socket is not available.

…removed in 3.12; creating a default ssl context and using it to wrap the socket for 3.12+)
@santhoshkpc
Copy link

i am also facing this issue, using Python 3.12.4.

@bebehei
Copy link

bebehei commented Nov 8, 2024

Fixes #68

TBH, code from #68 looks much cleaner in general.

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

Successfully merging this pull request may close these issues.

3 participants