urlib3 deprecation warning: HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.
MarkhamLee opened this issue · comments
Description
While using ".get_tasks_for_project" with a purposely incorrect project GID (testing exception handling), I received the following deprecation warning for urllib3:
HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.
More details on the warning are available here from urllib's change log, under the deprecation heading.
This issue appears to come from line 45 of rest.py in the Asana directory.
Expected Behavior: I wouldn't receive a deprecation warning
Environment:
OS: Ubuntu 22.04, Kernel 6.5
Python Version: 3.11.5
Suggested Fix:
Per the urlib3 docs, it appears that line 45 needs to be changed from:
return self.urllib3_response.getheaders()
to:
self.urllib3_response.headers.get(name, default)
I'd be willing to submit a PR for this issue.
Hi @MarkhamLee, thank you for reporting this. I can add this to our todo for our next update.
It looks like this fix might be as simple as bumping our code generator version.
I noticed there was a fix for this in swagger-codegen-geneartors: swagger-api/swagger-codegen-generators@53e68c7
Current swagger-codegen-generators version we are using is 3.0.46 we can upgrade to the latest version to get this fix
Thanks for the update!
@MarkhamLee Fixed in v5.0.5 release. v5.0.4 publish workflow failed so I had to release under v5.0.5
BEFORE (v5.0.3): https://github.com/Asana/python-asana/blob/v5.0.3/asana/rest.py#L43-L45
AFTER: (v5.0.5): https://github.com/Asana/python-asana/blob/v5.0.5/asana/rest.py#L43-L45