hbldh / pybankid

BankID Relying Party client for Python

Home Page:https://pybankid.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

cthart opened this issue · comments

  • pybankid version: 0.13.1
  • Python version: 3.8.10
  • Operating System: Ubuntu 20.04.6 LTS

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)
>>> 

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: urllib3/urllib3#3015

This is fixed now by version 0.14.0, see #49