getheaders is deprecated in urllib3 >= 2.0.0
还没有人认领这个 Issue。
评估
调研方向
打开 client/rest.py,检查 traceback 中引用的 getheaders 函数,然后检查其调用方以及现有的 urllib3 响应处理。移除已弃用的函数,并验证在使用 urllib3 >= 2.0.0 时,受影响的请求或异常路径不再调用它。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Python
- 星标
- 7.7k
- 派生
- 3.5k
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 18
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
kubernetes-client/python 的其他 Issue
-
Release 1.37 未关闭
kubernetes-client/python#2691 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
-
help wanted
难度 5/5 一周以上 新手友好度 35/100
kubernetes-client/python#2677 · 11 条评论 · 1 个 reaction ·
-
help wanted kind/feature
kubernetes-client/python#2602 · 6 条评论 · 已指派 1 人 ·
-
kind/bug
kubernetes-client/python#2596 · 11 条评论 · 2 个 reaction · 已指派 1 人 ·
-
kind/feature
kubernetes-client/python#2533 · 5 条评论 · 已指派 1 人 ·
查看 kubernetes-client/python 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
zostera/django-bootstrap4#894 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
use-agent-os/agent-os#3276 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
难度 2/5 1-3 小时 新手友好度 88/100
NousResearch/hermes-agent#117848 ·