Skip to content

Commit 70137a8

Browse files
#296 ClientConnectorSSLError and attachment filenames bugs fix (#297)
* #296 ClientConnectorSSLError bug fix. Replaced client_auth purpose with server_auth in ssl context creation in order to authenticate web servers. This fix the ssl context issue with Python 3.10. For the same occasion, we updated rest.py generated code to use a DataForm that does not encode attachment files. aioHttp dataForm object always encodes attachments filenames in utf-8 by default.
1 parent ceb223c commit 70137a8

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

api_client_generation/generate.sh

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ generate_files() {
4545
rm __init__.py # we don't care about __init__.py files
4646
cp *.py $project_root/symphony/bdk/gen/${name}_model
4747

48+
# update rest.py
49+
cd $code_gen_dir/output/symphony/bdk/gen
50+
cp rest.py $project_root/symphony/bdk/gen/rest.py
51+
4852
# remove downloaded files
4953
cd $code_gen_dir
5054
rm -r output
@@ -53,6 +57,7 @@ generate_files() {
5357
then
5458
rm $support_file_name
5559
fi
60+
5661
}
5762

5863
generate_files agent ${api_spec_base_url}/agent/agent-api-public-deprecated.yaml
11 Bytes
Binary file not shown.

symphony/bdk/gen/rest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None):
4747
if maxsize is None:
4848
maxsize = configuration.connection_pool_maxsize
4949

50-
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH, cafile=configuration.ssl_ca_cert)
50+
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=configuration.ssl_ca_cert)
5151
ssl_context.load_default_certs()
5252
ssl_context.verify_mode = ssl.CERT_REQUIRED
5353

@@ -140,7 +140,7 @@ async def request(self, method, url, query_params=None, headers=None,
140140
# must del headers['Content-Type'], or the correct
141141
# Content-Type which generated by aiohttp
142142
del headers['Content-Type']
143-
data = aiohttp.FormData()
143+
data = aiohttp.FormData(quote_fields=False)
144144
for param in post_params:
145145
k, v = param
146146
if isinstance(v, tuple) and len(v) == 3:

0 commit comments

Comments
 (0)