Skip to content

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

Open
fabiant7t wants to merge 1 commit into
aszlig:masterfrom
fabiant7t:master
Open

Fix for Python 3.12 (ssl.wrap_socket got removed)#66
fabiant7t wants to merge 1 commit into
aszlig:masterfrom
fabiant7t:master

Conversation

@fabiant7t

Copy link
Copy Markdown

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
Copy Markdown

i am also facing this issue, using Python 3.12.4.

@bebehei

bebehei commented Nov 8, 2024

Copy link
Copy Markdown

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