fix: python-asyncio/aiohttp with disabled ssl verification (#891)

This commit is contained in:
Tomasz Prus 2018-08-24 03:43:32 +02:00 committed by William Cheng
parent f2b0adfa05
commit 79dacb20a0
14 changed files with 92 additions and 86 deletions

View File

@ -38,21 +38,24 @@ class RESTClientObject(object):
def __init__(self, configuration, pools_size=4, maxsize=4):
# maxsize is number of requests to host that are allowed in parallel
# ca_certs vs cert_file vs key_file
# http://stackoverflow.com/a/23957365/2985775
# ca_certs
if configuration.ssl_ca_cert:
ca_certs = configuration.ssl_ca_cert
if configuration.verify_ssl:
# ca_certs
if configuration.ssl_ca_cert:
ca_certs = configuration.ssl_ca_cert
else:
# if not set certificate file, use Mozilla's root certificates.
ca_certs = certifi.where()
ssl_context = ssl.create_default_context(cafile=ca_certs)
if configuration.cert_file:
ssl_context.load_cert_chain(
configuration.cert_file, keyfile=configuration.key_file
)
else:
# if not set certificate file, use Mozilla's root certificates.
ca_certs = certifi.where()
ssl_context = ssl.create_default_context(cafile=ca_certs)
if configuration.cert_file:
ssl_context.load_cert_chain(
configuration.cert_file, keyfile=configuration.key_file
)
ssl_context = None
connector = aiohttp.TCPConnector(
limit=maxsize,

View File

@ -1 +1 @@
3.1.1-SNAPSHOT
3.2.3-SNAPSHOT

View File

@ -57,10 +57,10 @@ client = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.test_special_tags(client)
api_response = api_instance.call_123_test_special_tags(client)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e)
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
@ -70,7 +70,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |

View File

@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
# **test_special_tags**
> Client test_special_tags(client)
# **call_123_test_special_tags**
> Client call_123_test_special_tags(client)
To test special tags
To test special tags
To test special tags and operation ID starting with number
### Example
```python
@ -28,10 +28,10 @@ client = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.test_special_tags(client)
api_response = api_instance.call_123_test_special_tags(client)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e)
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
### Parameters

View File

@ -32,13 +32,13 @@ class AnotherFakeApi(object):
api_client = ApiClient()
self.api_client = api_client
def test_special_tags(self, client, **kwargs): # noqa: E501
def call_123_test_special_tags(self, client, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_special_tags(client, async_req=True)
>>> thread = api.call_123_test_special_tags(client, async_req=True)
>>> result = thread.get()
:param async_req bool
@ -49,18 +49,18 @@ class AnotherFakeApi(object):
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501
return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
else:
(data) = self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501
(data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
return data
def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_special_tags_with_http_info(client, async_req=True)
>>> thread = api.call_123_test_special_tags_with_http_info(client, async_req=True)
>>> result = thread.get()
:param async_req bool
@ -82,14 +82,14 @@ class AnotherFakeApi(object):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method test_special_tags" % key
" to method call_123_test_special_tags" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'client' is set
if ('client' not in local_var_params or
local_var_params['client'] is None):
raise ValueError("Missing the required parameter `client` when calling `test_special_tags`") # noqa: E501
raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501
collection_formats = {}

View File

@ -46,21 +46,24 @@ class RESTClientObject(object):
def __init__(self, configuration, pools_size=4, maxsize=4):
# maxsize is number of requests to host that are allowed in parallel
# ca_certs vs cert_file vs key_file
# http://stackoverflow.com/a/23957365/2985775
# ca_certs
if configuration.ssl_ca_cert:
ca_certs = configuration.ssl_ca_cert
if configuration.verify_ssl:
# ca_certs
if configuration.ssl_ca_cert:
ca_certs = configuration.ssl_ca_cert
else:
# if not set certificate file, use Mozilla's root certificates.
ca_certs = certifi.where()
ssl_context = ssl.create_default_context(cafile=ca_certs)
if configuration.cert_file:
ssl_context.load_cert_chain(
configuration.cert_file, keyfile=configuration.key_file
)
else:
# if not set certificate file, use Mozilla's root certificates.
ca_certs = certifi.where()
ssl_context = ssl.create_default_context(cafile=ca_certs)
if configuration.cert_file:
ssl_context.load_cert_chain(
configuration.cert_file, keyfile=configuration.key_file
)
ssl_context = None
connector = aiohttp.TCPConnector(
limit=maxsize,

View File

@ -1 +1 @@
3.1.1-SNAPSHOT
3.2.3-SNAPSHOT

View File

@ -57,10 +57,10 @@ client = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.test_special_tags(client)
api_response = api_instance.call_123_test_special_tags(client)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e)
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
@ -70,7 +70,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |

View File

@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
# **test_special_tags**
> Client test_special_tags(client)
# **call_123_test_special_tags**
> Client call_123_test_special_tags(client)
To test special tags
To test special tags
To test special tags and operation ID starting with number
### Example
```python
@ -28,10 +28,10 @@ client = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.test_special_tags(client)
api_response = api_instance.call_123_test_special_tags(client)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e)
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
### Parameters

View File

@ -32,13 +32,13 @@ class AnotherFakeApi(object):
api_client = ApiClient()
self.api_client = api_client
def test_special_tags(self, client, **kwargs): # noqa: E501
def call_123_test_special_tags(self, client, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_special_tags(client, async_req=True)
>>> thread = api.call_123_test_special_tags(client, async_req=True)
>>> result = thread.get()
:param async_req bool
@ -49,18 +49,18 @@ class AnotherFakeApi(object):
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501
return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
else:
(data) = self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501
(data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
return data
def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_special_tags_with_http_info(client, async_req=True)
>>> thread = api.call_123_test_special_tags_with_http_info(client, async_req=True)
>>> result = thread.get()
:param async_req bool
@ -82,14 +82,14 @@ class AnotherFakeApi(object):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method test_special_tags" % key
" to method call_123_test_special_tags" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'client' is set
if ('client' not in local_var_params or
local_var_params['client'] is None):
raise ValueError("Missing the required parameter `client` when calling `test_special_tags`") # noqa: E501
raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501
collection_formats = {}

View File

@ -1 +1 @@
3.2.0-SNAPSHOT
3.2.3-SNAPSHOT

View File

@ -57,10 +57,10 @@ client = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.test_special_tags(client)
api_response = api_instance.call_123_test_special_tags(client)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e)
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
@ -70,7 +70,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |

View File

@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
# **test_special_tags**
> Client test_special_tags(client)
# **call_123_test_special_tags**
> Client call_123_test_special_tags(client)
To test special tags
To test special tags
To test special tags and operation ID starting with number
### Example
```python
@ -28,10 +28,10 @@ client = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.test_special_tags(client)
api_response = api_instance.call_123_test_special_tags(client)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e)
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
### Parameters

View File

@ -32,13 +32,13 @@ class AnotherFakeApi(object):
api_client = ApiClient()
self.api_client = api_client
def test_special_tags(self, client, **kwargs): # noqa: E501
def call_123_test_special_tags(self, client, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_special_tags(client, async_req=True)
>>> thread = api.call_123_test_special_tags(client, async_req=True)
>>> result = thread.get()
:param async_req bool
@ -49,18 +49,18 @@ class AnotherFakeApi(object):
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501
return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
else:
(data) = self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501
(data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
return data
def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_special_tags_with_http_info(client, async_req=True)
>>> thread = api.call_123_test_special_tags_with_http_info(client, async_req=True)
>>> result = thread.get()
:param async_req bool
@ -82,14 +82,14 @@ class AnotherFakeApi(object):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method test_special_tags" % key
" to method call_123_test_special_tags" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'client' is set
if ('client' not in local_var_params or
local_var_params['client'] is None):
raise ValueError("Missing the required parameter `client` when calling `test_special_tags`") # noqa: E501
raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501
collection_formats = {}