peeter123 / digikey-api

Python module for the Digikey PartSearch API
GNU General Public License v3.0
83 stars 34 forks source link

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

Open 193thz opened 2 weeks ago

193thz commented 2 weeks ago

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 commented 2 weeks ago

I see there are already pull requests addressing this. Cool