-
Notifications
You must be signed in to change notification settings - Fork 71
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
response_types_map
not treated as an optional argument
#310
Comments
Thanks, definitely it's worth to fix it 👍 But I'm curious what's your use case, because usually this method is not called directly? |
Sorry it took me so long to respond. I was working on some code where the use-case was to periodically send commands to kubernetes, but we wanted to check that the kubernetes cluster was ready first. Kubernetes exposes this through the |
Fair enough, thanks. |
Problem
Using
kubernetes_asyncio.api_client.call_api
without passing the argumentresponse_types_map
fails.I would recommend skipping the reproduction I added below, as the bug is trivial and should be simple to understand in the "explanation" section.
Minimal reproduction
(Running inside a container on a k8s deployment, for simplicity.)
This fails with the error:
Explanation
The method
call_api
takes an optional argumentresponse_types_map
:def call_api(self, resource_path, ..., response_types_map=None, ...)
https://github.com/tomplus/kubernetes_asyncio/blob/master/kubernetes_asyncio/client/api_client.py#L330
This argument is passed on to the
__call_api
method: https://github.com/tomplus/kubernetes_asyncio/blob/master/kubernetes_asyncio/client/api_client.py#L121In the
__call_api
method, the argument is not treated as optional: https://github.com/tomplus/kubernetes_asyncio/blob/master/kubernetes_asyncio/client/api_client.py#L201If
response_types_map
was not passed in (which it is not by default), this line fails, asresponse_types_map
isNone
, not a dictionary.Fix
Fixed in: #311
The text was updated successfully, but these errors were encountered: