Skip to content

Commit bfdc475

Browse files
authored
Fix usage of response_types_map inside API client's call_api method. (#362)
* Fix: handle unset response_types_map argument * Undo automated formatting
1 parent abd4624 commit bfdc475

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

kubernetes_asyncio/client/api_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ async def __call_api(
198198
if not _preload_content:
199199
return return_data
200200

201-
response_type = response_types_map.get(response_data.status, None)
201+
response_type = None
202+
if response_types_map:
203+
response_type = response_types_map.get(response_data.status, None)
202204

203205
if six.PY3 and response_type not in ["file", "bytes"]:
204206
match = None
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/kubernetes_asyncio/client/api_client.py b/kubernetes_asyncio/client/api_client.py
2+
index 0d543478..2791a9cd 100644
3+
--- a/kubernetes_asyncio/client/api_client.py
4+
+++ b/kubernetes_asyncio/client/api_client.py
5+
@@ -198,7 +198,9 @@ class ApiClient(object):
6+
if not _preload_content:
7+
return return_data
8+
9+
- response_type = response_types_map.get(response_data.status, None)
10+
+ response_type = None
11+
+ if response_types_map:
12+
+ response_type = response_types_map.get(response_data.status, None)
13+
14+
if six.PY3 and response_type not in ["file", "bytes"]:
15+
match = None

scripts/update-client.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ sed -i'' "s,^DEVELOPMENT_STATUS = .*,DEVELOPMENT_STATUS = \\\"${DEVELOPMENT_STAT
6666

6767
echo ">>> fix generated api client for patching with strategic merge..."
6868
patch "${CLIENT_ROOT}/client/api_client.py" "${SCRIPT_ROOT}/api_client_strategic_merge_patch.diff"
69+
echo ">>> fix generated api client by adding 'none' check..."
70+
patch "${CLIENT_ROOT}/client/api_client.py" "${SCRIPT_ROOT}/api_client_response_types_map.diff"
6971
echo ">>> fix generated rest client by accepting application/apply-patch+yaml content type"
7072
patch "${CLIENT_ROOT}/client/rest.py" "${SCRIPT_ROOT}/rest_client_apply_patch_patch.diff"
7173
echo ">>> fix generated rest client by increasing aiohttp read buffer to 2MiB..."

0 commit comments

Comments
 (0)