python icon indicating copy to clipboard operation
python copied to clipboard

connect_get_namespaced_service_proxy_with_path messes up response

Open david0 opened this issue 7 months ago • 4 comments

What happened (please include outputs or screenshots):

Im running connect_get_namespaced_service_proxy_with_path(name, namespace, path="actuator") to get JSON data from my webservice.

The result is a JSON list: ["foo", "bar"]

but the function returns ['foo', 'bar']

What you expected to happen: The function to return ["foo", "bar"] or to return the list or a bytearray.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

It looks like the deserialisation messes it up. It can be worked around by passing _preload_content=False

Environment:

  • Kubernetes version (kubectl version): v1.25.13
  • OS (e.g., MacOS 10.13.6): MacOS 13.6
  • Python version (python --version): Python 3.9.17
  • Python client version (pip list | grep kubernetes): 28.1.0

david0 avatar Dec 05 '23 10:12 david0

The result is a JSON list: ["foo", "bar"]

but the function returns ['foo', 'bar']

Could you elaborate what's the difference between the two responses?

roycaihw avatar Feb 12 '24 17:02 roycaihw

The webservice that I'm trying to connect will return a JSON list of strings (with doublequotes): ["foo", "bar"]

connect_get_namespaced_service_proxy_with_path(name, namespace, path="actuator") will return a str with the value ['foo', 'bar'] , which is very unexpected for me. I mean it looks on first sight like a valid python list, but its returned as a str(!) instead of list.

If the return value would be a list, it would be fine. But I guess intuitively everyone would expect that it would return the raw, original response string ["foo", "bar"]

david0 avatar Feb 12 '24 19:02 david0