Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getheaders is deprecated in urllib3 >= 2.0.0 #2280

Open
mvalenzisi opened this issue Sep 12, 2024 · 0 comments · May be fixed by #2287
Open

getheaders is deprecated in urllib3 >= 2.0.0 #2280

mvalenzisi opened this issue Sep 12, 2024 · 0 comments · May be fixed by #2287
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@mvalenzisi
Copy link

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 mvalenzisi added the kind/bug Categorizes issue or PR as related to a bug. label Sep 12, 2024
@poorvaja-s-hub poorvaja-s-hub linked a pull request Sep 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant