digikey-api icon indicating copy to clipboard operation
digikey-api copied to clipboard

Error under Python 3.12 AttributeError: module 'ssl' has no attribute 'wrap_socket'

Open 193thz opened this issue 1 year ago • 1 comments

Library doesn't work under Python 3.12 but does under 3.11. My understanding is this is due to a change in 3.12 covered here: https://github.com/eventlet/eventlet/issues/795

File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\digikey\v3\api.py", line 55, in __init__
   self._digikeyApiToken = digikey.oauth.oauth2.TokenHandler(version=3, sandbox=self.sandbox).get_access_token()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\digikey\oauth\oauth2.py", line 255, in get_access_token
   httpd.socket = ssl.wrap_socket(httpd.socket, certfile=str(Path(filename)), server_side=True)
                  ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

193thz avatar Jul 04 '24 05:07 193thz

I see there are already pull requests addressing this. Cool

193thz avatar Jul 05 '24 16:07 193thz

This has been released in version 1.1.0.

peeter123 avatar Nov 22 '24 09:11 peeter123