Skip to content

Fix usage of response_types_map inside API client's call_api method. #311

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion kubernetes_asyncio/client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions scripts/api_client_response_types_map_patch.diff
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions scripts/update-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 increasing aiohttp read buffer to 2MiB..."
patch "${CLIENT_ROOT}/client/rest.py" "${SCRIPT_ROOT}/rest_client_patch_read_bufsize.diff"
echo ">>> fix generated rest client and configuration to support customer server hostname TLS verification..."
Expand Down