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

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

Open
MarkStoutjesdijk opened this issue May 3, 2024 · 4 comments
Open

Comments

@MarkStoutjesdijk
Copy link

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 eventlet/eventlet#795. It would be great if you could take a look at this!

@supersaiyanmode
Copy link
Owner

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
Copy link
Author

MarkStoutjesdijk commented May 12, 2024 via email

@umetzu
Copy link

umetzu commented Sep 18, 2024

Yes, his solution works, add the protocol to skip the deprecation warning.

ssl.wrap_socket = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2).wrap_socket

@apppie123
Copy link

Whas this already implemented? I just installed 8.10 but I am getting this error.

Exception has occurred: AttributeError
module 'ssl' has no attribute 'wrap_socket'
File "src/test.py", line 64, in
client.connect()
AttributeError: module 'ssl' has no attribute 'wrap_socket'

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

No branches or pull requests

4 participants