hbldh / pybankid

BankID Relying Party client for Python
https://pybankid.readthedocs.io
MIT License
46 stars 19 forks source link

Bug with latest versions of requests (2.23.0) and urllib3 (2.0.2) #47

Closed cthart closed 1 year ago

cthart commented 1 year ago

Description

After upgrading to the above mentioned just released versions of requests and urllib3, get an exception in pybankid code.

What I Did

~$ python
Python 3.8.10 (default, Mar 13 2023, 10:26:41) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bankid import BankIDJSONClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/colin/venv/lib/python3.8/site-packages/bankid/__init__.py", line 24, in <module>
    from requests.packages.urllib3.exceptions import SubjectAltNameWarning as _sanw
ImportError: cannot import name 'SubjectAltNameWarning' from 'urllib3.exceptions' (/home/colin/venv/lib/python3.8/site-packages/urllib3/exceptions.py)
>>> 
cthart commented 1 year ago

This is a breaking change with the new version of urllib3, not requests. I downgraded urllib3 to 1.26.15 (last version prior to the recent 2.0) but retained the latest version of requests (2.30.0) and now the import works fine:

$ python
Python 3.8.10 (default, Mar 13 2023, 10:26:41) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bankid import BankIDJSONClient
>>> 

This was confirmed by a urllib3 developer: https://github.com/urllib3/urllib3/issues/3015

cthart commented 1 year ago

This is fixed now by version 0.14.0, see #49