-
Notifications
You must be signed in to change notification settings - Fork 15
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
lightkube doesnot work with httpx 0.28.x #78
Comments
Hi, what authentication method are you using? Can you post the corresponding configuration section (properly anonymized)? |
There seems to be actually a bug in httpx v0.8.0 that will be fixed in 0.28.1: encode/httpx#3442 |
I released v0.15.6 to temporary avoid httpx version 0.28.0. Fixing the deprecation will require first compatiblity of RESPX lundberg/respx#277 with the changes to 0.28 and also the release of httpx 0.28.1 encode/httpx#3445 |
|
|
I have a fresh install of lightkube (version 0.15.6) which brings in httpx 0.28.1 as dependency and I'm also having this issue. $ kubectl config current-context
k3d-test
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
k3d-test-agent-0 Ready <none> 7d22h v1.30.6+k3s1
k3d-test-server-0 Ready control-plane,master 7d22h v1.30.6+k3s1 from lightkube import Client
from lightkube.resources.core_v1 import Node
client = Client()
for node in client.list(Node):
print(node.metadata.name)
Traceback (most recent call last):
File "/Users/logileifsson/tmp/registrator/__pypackages__/3.11/lib/lightkube/core/generic_client.py", line 235, in raise_for_status
resp.raise_for_status()
File "/Users/logileifsson/tmp/registrator/__pypackages__/3.11/lib/httpx/_models.py", line 829, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://0.0.0.0:57271/api/v1/nodes'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/logileifsson/tmp/registrator/__pypackages__/3.11/lib/lightkube/core/generic_client.py", line 318, in list
cont, chunk = self.handle_response("list", resp, br)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/logileifsson/tmp/registrator/__pypackages__/3.11/lib/lightkube/core/generic_client.py", line 251, in handle_response
self.raise_for_status(resp)
File "/Users/logileifsson/tmp/registrator/__pypackages__/3.11/lib/lightkube/core/generic_client.py", line 237, in raise_for_status
raise transform_exception(e)
lightkube.core.exceptions.ApiError: Unauthorized client.config
SingleConfig(context_name='k3d-test', context=Context(cluster='k3d-test', user='admin@k3d-test', namespace=None), cluster=Cluster(server='https://0.0.0.0:57271', certificate_auth=None, certificate_auth_data='LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJlRENDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUzTXpNeU1qZ3hOVFV3SGhjTk1qUXhNakF6TVRJeE5UVTFXaGNOTXpReE1qQXhNVEl4TlRVMQpXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUzTXpNeU1qZ3hOVFV3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFTQW9odmVFQUVCRUpuQjBoRFJXak9KN1gvVDZTWHhFSk4vV3hPS0Vac2YKd2wzRlI0bGFqM0RtL2JPZFM4ano0SkxmcnNyVDRBbll5bEF2bFBmRVNPSkdvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVWxqNk9pbTZUbUFFak95b28rWk1LClBCQWVIWUF3Q2dZSUtvWkl6ajBFQXdJRFNRQXdSZ0loQUxoVnZwVnNvdXBaZjdOb2N1RXF4S0JEenZwdCtwNVIKMU5QTjdwQmJnUWFhQWlFQXliQmVRMFNnem9iZ3V0VUwxaklHTjNiMVpNcDBySWtkK3ljTW1qWlFLeEE9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K', insecure=False), user=User(exec=None, username=None, password=None, token=None, auth_provider=None, client_cert=None, client_cert_data='LS0tLS1CRUdJTiBDRVJUSUZJQ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hOVFV3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFUOXFSR3lBNTZ5cE1ySytKU1BJSllld2Z4L0hRNldKdnNrZDVYUzhtbWgKVkszVFdyS0lVV2Qvb3pjYWZhNWdLRFhkaXVEWEM0OFBFQVRCVUtneFBXMFVvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVW5iZ1paYTkwdTIyT2FmZG1Xcm40CjNpbURSZTh3Q2dZSUtvWkl6ajBFQXdJRFNBQXdSUUlnQXdDUDJEZmYrallLZjltVmFBOXdLQ2hNZUR6NlpHbU8KUUlnbnQ2ZUo0MUVDSVFDSDhmbUkybjZNVlFSd3MzUk9SZTVJMWdKU0FEbTlQVVVhMWxmVVc5cUt6QT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K', client_key=None, client_key_data='LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUM4dzR5SjlCU0hMdTIyeTlTbHhoOEhYZENFeUxGbHZiVkJMU2xacnl0VkFvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFdHZWbXlLbWJuQjBKTFA2SUFuQkczNXFNOTR5Q0ttR3RkZlhzSldOdUU3TDE1OFFiV2NydgowSnIrdWJnek9wY0g0cWtpV1IveXFTb2hzMkFEMnBLTVhRPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo='), fname=PosixPath('/Users/logileifsson/.kube/config')) |
And I can confirm that downgrading httpx to 0.27.2 fixes the issue |
Thanks for the details, this is going to be useful for the investigation. For now I just released |
Running lightkube get/list commands failed with Unauthorized error.
Ran a sample from documentation:
Error message:
Tried the same by downgrading httpx package to 0.27.x and it worked.
There are ssl related changes to httpx 0.28.0 which might cause this issue, see release notes
https://github.com/encode/httpx/releases/tag/0.28.0
The text was updated successfully, but these errors were encountered: