python icon indicating copy to clipboard operation
python copied to clipboard

getheaders is deprecated in urllib3 >= 2.0.0

Open mvalenzisi opened this issue 1 year ago • 12 comments

Please remove the deprecated function getheaders from client/rest.py

What happened (please include outputs or screenshots):

Traceback (most recent call last):
  File "/home/mau/repos/project-automation/k8s/k8s.py", line 828, in <module>
    main()
  File "/home/mau/repos/project-automation/k8s/k8s.py", line 803, in main
    k8s_project.create_namespace()
  File "/home/mau/repos/project-automation/k8s/k8s.py", line 110, in create_namespace
    self.__k8s_cluster.create_namespace(
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/pja_sdk/k8s.py", line 98, in create_namespace
    namespace = self.__corev1api.create_namespace(body=body)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/api/core_v1_api.py", line 6363, in create_namespace
    return self.create_namespace_with_http_info(body, **kwargs)  # noqa: E501
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/api/core_v1_api.py", line 6454, in create_namespace_with_http_info
    return self.api_client.call_api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
    response_data = self.request(
                    ^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/api_client.py", line 391, in request
    return self.rest_client.POST(url,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/rest.py", line 279, in POST
    return self.request("POST", url,
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/rest.py", line 238, in request
    raise ApiException(http_resp=r)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/exceptions.py", line 91, in __init__
    self.headers = http_resp.getheaders()
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mau/.virtualenvs/project-automation-2/lib/python3.12/site-packages/kubernetes/client/rest.py", line 44, in getheaders
    return self.urllib3_response.getheaders()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'HTTPResponse' object has no attribute 'getheaders'. Did you mean: 'headers'?

How to reproduce it (as minimally and precisely as possible): Install requirements (urllib3 >= 2.0.0) and call any function.

Environment:

  • Kubernetes version (kubectl version): v1.29.5
  • OS (e.g., MacOS 10.13.6): Linux
  • Python version (python --version) 3.12.3
  • Python client version (pip list | grep kubernetes) 29.0.0

mvalenzisi avatar Sep 12 '24 14:09 mvalenzisi

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Dec 11 '24 15:12 k8s-triage-robot

/remove-lifecycle stale

vittoriocanilli avatar Dec 12 '24 15:12 vittoriocanilli

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Mar 12 '25 15:03 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Apr 11 '25 16:04 k8s-triage-robot

/remove-lifecycle rotten

vittoriocanilli avatar Apr 17 '25 12:04 vittoriocanilli

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jul 16 '25 12:07 k8s-triage-robot

/remove-lifecycle stale

JulianJvn avatar Aug 06 '25 06:08 JulianJvn

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Nov 04 '25 06:11 k8s-triage-robot

/remove-lifecycle stale

JulianJvn avatar Nov 04 '25 08:11 JulianJvn

urllib3 removes the function, causing failures: https://github.com/urllib3/urllib3/releases/tag/2.6.0

cg505 avatar Dec 05 '25 22:12 cg505

running ansible-operator based controllers, 2.6.0 broke a bunch of my code too won't merge those renovate PRs for now, sticking to urllib3==2.5.0

faust64 avatar Dec 06 '25 11:12 faust64

Just to add here as well

This issue does not allow anyone who would like to use k8s client to upgrafde to 2.6.0 that contains fixes to important vulnerabilities

Specifically those two which are assessed as "high" severity - 8.9/10 both

https://nvd.nist.gov/vuln/detail/CVE-2025-66471 https://nvd.nist.gov/vuln/detail/CVE-2025-66418

potiuk avatar Dec 07 '25 11:12 potiuk