Skip to content

Commit 087e4b4

Browse files
tomplusk8s-ci-robot
authored andcommitted
fix: python/asyncio no-ssl-verify for server certs only (#81)
1 parent 4aa859f commit 087e4b4

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

openapi/python-asyncio-rest.py.patch

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
21a22,23
22
> import asyncio
33
>
4-
67c69
4+
64a67,70
5+
> if not configuration.verify_ssl:
6+
> ssl_context.check_hostname = False
7+
> ssl_context.verify_mode = ssl.CERT_NONE
8+
>
9+
67,68c73
510
< ssl_context=ssl_context,
11+
< verify_ssl=configuration.verify_ssl
612
---
7-
> ssl_context=ssl_context if configuration.verify_ssl else None,
8-
81a84,86
13+
> ssl_context=ssl_context
14+
81a87,89
915
> def __del__(self):
1016
> asyncio.ensure_future(self.pool_manager.close())
1117
>
12-
130a136,138
18+
130a139,141
1319
> if headers['Content-Type'] == 'application/json-patch+json':
1420
> if not isinstance(body, list):
1521
> headers['Content-Type'] = 'application/strategic-merge-patch+json'
16-
164c172,174
22+
164c175,177
1723
< async with self.pool_manager.request(**args) as r:
1824
---
1925
> r = await self.pool_manager.request(**args)
2026
> if _preload_content:
2127
>
22-
168,169c178,179
28+
168,169c181,182
2329
< # log response body
2430
< logger.debug("response body: %s", r.data)
2531
---
2632
> # log response body
2733
> logger.debug("response body: %s", r.data)
28-
171,172c181,182
34+
171,172c184,185
2935
< if not 200 <= r.status <= 299:
3036
< raise ApiException(http_resp=r)
3137
---

openapi/python-asyncio.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ if [ ${PACKAGE_NAME} == "client" ]; then
7171
# workaround https://github.com/swagger-api/swagger-codegen/pull/8204
7272
# + closing session
7373
# + support application/strategic-merge-patch+json
74-
# workaround https://github.com/swagger-api/swagger-codegen/pull/8507
74+
# workaround https://github.com/swagger-api/swagger-codegen/pull/8797
7575
# + aiohttp without verify_ssl
7676
patch "${OUTPUT_DIR}/client/rest.py" "${SCRIPT_ROOT}/python-asyncio-rest.py.patch"
7777

0 commit comments

Comments
 (0)