Skip to content

Library incompatibility with urllib3 version 1.26.5 #4

@nicosemp

Description

@nicosemp

Hi! I'm trying to use this sdk with Home Assistant, but there is a mismatch in urllib3 versions.

Home Assistant introduced a constraint in 2023: urllib3>=1.26.5,<2 for compatibility with some integrations.

This sdk declares support for urllib3 >= 1.25.3, < 3.0.0, so there should be an overlap with version 1.26.5. However I tested this locally with pip install --force-reinstall -v "urllib3==1.26.5" in the project, and I got an error:

TypeError: PoolKey.__new__() got an unexpected keyword argument 'key_ca_cert_data'

Now of course ynab-sdk-python could just raise the minimum version to 2.x and call it a day, but this would mean no compatibility with Home Assistant. The only way to make calls to the YNAB API would be to do it manually at that point.

Would it be possible to fix this error and make the library work with urllib3==1.26.5, like it declares in the requirements?

Thank you!

Full stack trace of the error above:

Traceback (most recent call last):
  File "<PATH_TO_PROJECT>\python-ynab-api-test\ynab_test.py", line 15, in <module>
    accounts_response = accounts_api.get_accounts(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\pydantic\_internal\_validate_call.py", line 38, in wrapper_function
    return wrapper(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\pydantic\_internal\_validate_call.py", line 111, in __call__
    res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\ynab\api\accounts_api.py", line 676, in get_accounts
    response_data = self.api_client.call_api(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\ynab\api_client.py", line 273, in call_api
    response_data = self.rest_client.request(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\ynab\rest.py", line 246, in request
    r = self.pool_manager.request(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\urllib3\request.py", line 74, in request
    return self.request_encode_url(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\urllib3\request.py", line 96, in request_encode_url
    return self.urlopen(method, url, **extra_kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\urllib3\poolmanager.py", line 364, in urlopen
    conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\urllib3\poolmanager.py", line 245, in connection_from_host
    return self.connection_from_context(request_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\urllib3\poolmanager.py", line 258, in connection_from_context
    pool_key = pool_key_constructor(request_context)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH_TO_PROJECT>\python-ynab-api-test\.venv\Lib\site-packages\urllib3\poolmanager.py", line 124, in _default_key_normalizer
    return key_class(**context)
           ^^^^^^^^^^^^^^^^^^^^
TypeError: PoolKey.__new__() got an unexpected keyword argument 'key_ca_cert_data'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions