diff --git a/kubernetes_asyncio/client/api_client.py b/kubernetes_asyncio/client/api_client.py index 02c9d0f2..36609e78 100644 --- a/kubernetes_asyncio/client/api_client.py +++ b/kubernetes_asyncio/client/api_client.py @@ -198,7 +198,9 @@ async def __call_api( if not _preload_content: return return_data - response_type = response_types_map.get(response_data.status, None) + response_type = None + if response_types_map: + response_type = response_types_map.get(response_data.status, None) if six.PY3 and response_type not in ["file", "bytes"]: match = None diff --git a/scripts/api_client_response_types_map_patch.diff b/scripts/api_client_response_types_map_patch.diff new file mode 100644 index 00000000..71f939d5 --- /dev/null +++ b/scripts/api_client_response_types_map_patch.diff @@ -0,0 +1,15 @@ +diff --git a/kubernetes_asyncio/client/api_client.py b/kubernetes_asyncio/client/api_client.py +index 0d543478..2791a9cd 100644 +--- a/kubernetes_asyncio/client/api_client.py ++++ b/kubernetes_asyncio/client/api_client.py +@@ -198,7 +198,9 @@ class ApiClient(object): + if not _preload_content: + return return_data + +- response_type = response_types_map.get(response_data.status, None) ++ response_type = None ++ if response_types_map: ++ response_type = response_types_map.get(response_data.status, None) + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None diff --git a/scripts/update-client.sh b/scripts/update-client.sh index fa345c73..d6beedb7 100755 --- a/scripts/update-client.sh +++ b/scripts/update-client.sh @@ -66,6 +66,8 @@ sed -i'' "s,^DEVELOPMENT_STATUS = .*,DEVELOPMENT_STATUS = \\\"${DEVELOPMENT_STAT echo ">>> fix generated api client for patching with strategic merge..." patch "${CLIENT_ROOT}/client/api_client.py" "${SCRIPT_ROOT}/api_client_strategic_merge_patch.diff" +echo ">>> fix generated api client by adding 'none' check..." +patch "${CLIENT_ROOT}/client/api_client.py" "${SCRIPT_ROOT}/api_client_response_types_map.diff" echo ">>> fix generated rest client by accepting application/apply-patch+yaml content type" patch "${CLIENT_ROOT}/client/rest.py" "${SCRIPT_ROOT}/rest_client_apply_patch_patch.diff" echo ">>> fix generated rest client by increasing aiohttp read buffer to 2MiB..."