Skip to content

WSS doesn't work on Python 3.12+ #287

Closed
@jolaf

Description

@jolaf

The following code:

from ws4py.client.threadedclient import WebSocketClient

WebSocketClient('wss://google.com').connect()

produces the following output:

$ python test.py 
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    WebSocketClient('wss://google.com').connect()
  File "/home/jolaf/.local/lib/python3.12/site-packages/ws4py/client/__init__.py", line 214, in connect
    self.sock = ssl.wrap_socket(self.sock, **self.ssl_options)
                ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

because ssl.wrap_socket() was removed in Python 3.12.

$ python3 --version
Python 3.12.3

$ lsb_release -d
No LSB modules are available.
Description:	Ubuntu 24.04 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions