hetzner
hetzner copied to clipboard
Fix for Python 3.12 (ssl.wrap_socket got removed)
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.