plaid / plaid-python

Python bindings for Plaid
https://plaid.com/docs
MIT License
418 stars 146 forks source link

urllib3 deprecation warning #523

Open radoshi opened 1 month ago

radoshi commented 1 month ago

Hello,

We're seeing deprecation warnings in plaid python lib for urllib3

  /.../lib/python3.12/site-packages/plaid/exceptions.py:105: DeprecationWarning: HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.
    self.headers = http_resp.getheaders()

python: 3.12.4 plaid-python: 23.0.0

It's coming from: https://github.com/plaid/plaid-python/blob/master/plaid/exceptions.py#L105

Urllib's current version (as of 7/16/24) is 2.2.2 Here is the urllib3 code in question: https://github.com/urllib3/urllib3/blob/main/src/urllib3/response.py#L514

In the past, this doesn't seem to have been a priority: https://github.com/plaid/plaid-python/issues/447 and https://github.com/plaid/plaid-python/issues/474 (to be fair, slightly different file, though I suspect same solution).

The urllib3 dependency in the plaid lib is >1.25.3 https://github.com/plaid/plaid-python/blob/master/setup.py#L7

I could be wrong, but I believe this update to requirements.txt didn't actually restrict urllib3 to 2.1.0 as intended: https://github.com/plaid/plaid-python/issues/447#issuecomment-1363088131

(FWIW I don't think you should restrict it any longer since 2.1.0 has been superceded since January of this year.)

Is there any chance of a fix for this?

Thank you so much!

phoenixy1 commented 1 month ago

Thanks for filing this!

What has changed since the last time this issue was filed is that this has been fixed upstream https://github.com/OpenAPITools/openapi-generator/blame/master/samples/client/echo_api/python/openapi_client/rest.py#L54 so while upgrading the python generator version continues to be an extremely messy prospect (due to the extensive breaking changes it would cause for users of the python client library), we could try cherry-picking the fix.

We can't promise a timeline (this doesn't appear to be a super urgent issue for anyone) but I'll take a look when I get a chance.

(BTW the intention of the edit in the requirements.txt is to prevent the use of urllib3 2.1.0 and later versions, not to allow it, so I think the edit is correct (although could be less strict, since I believe it is currently also blocking urllib3 2.0). )

phoenixy1 commented 1 month ago

Just wanted to update that a fix has been pushed, so this is anticipated to be fixed in the next release of the plaid-python client library.

radoshi commented 1 month ago

@phoenixy1 amazing! Thank you.

emosenkis commented 3 weeks ago

@phoenixy1 the restriction on urllib3 hasn't been removed from requirements.txt in master. Is that expected to happen also?

phoenixy1 commented 3 weeks ago

@emosenkis yes, it is part of the fix that will be in the next release of the plaid-python client library

abeerag commented 2 weeks ago

Hi @phoenixy1 When is the next release of the library expected?

phoenixy1 commented 2 weeks ago

@abeerag end of October at the absolute latest, but I think it will probably be released in September.