supersaiyanmode / PyWebOSTV

Python API for controlling LG TVs (Web OS)
MIT License
261 stars 50 forks source link

AttributeError: module 'ssl' has no attribute 'wrap_socket' #108

Open MarkStoutjesdijk opened 2 months ago

MarkStoutjesdijk commented 2 months ago

Hi,

Using secure connection, I am getting an error:

AttributeError: module 'ssl' has no attribute 'wrap_socket'

I suspect it is due to a change in Python -- see https://github.com/eventlet/eventlet/issues/795. It would be great if you could take a look at this!

supersaiyanmode commented 2 months ago

Thanks! I didn't know about this one. This is indeed because ssl library changes in latest Python.

I was looking at the connect(..) here -- unfortunately, it looks like it hasn't been written in a manner that allows for SSL context to overridden by child classes, without copying the entire function.

That being said, we can perhaps try having ssl.wrap_socket point to something else ( HACKY + UNTESTED):

# Before any library imports that depends on ssl..
ssl.wrap_socket = ssl.SSLContext().wrap_socket

.. can you please confirm if this works for you? If so, I'll try incorporating this in this library..

MarkStoutjesdijk commented 1 month ago
Thanks! I didn't know about this one. This is indeed because ssl library changes in latest Python.

I was looking [at the connect(..) here](https://github.com/Lawouach/WebSocket-for-Python/blob/961c07ce16ce4eedc34ca1fdacd29442870feccc/ws4py/client/__init__.py#L214) -- unfortunately, it looks like it hasn't been written in a manner that allows for SSL context to overridden by child classes, without copying the entire function.

That being said, we can perhaps try having `ssl.wrap_socket` point to something else ( **HACKY + UNTESTED**):

```
# Before any library imports that depends on ssl..
ssl.wrap_socket = ssl.SSLContext().wrap_socket
```

.. can you please confirm if this works for you? If so, I'll try incorporating this in this library..

--
Reply to this email directly or view it on GitHub:
https://github.com/supersaiyanmode/PyWebOSTV/issues/108#issuecomment-2095947350
You are receiving this because you authored the thread.

Message ID: ***@***.***>