forked from loafle/openapi-generator-original
python: remove non-async code path from the aiohttp generator (#16601)
* python: remove non-async code path from the aiohttp generator This removes all the non-async code from the aiohttp generator: * all the methods that should be asynchronous are marked as `async` * the `async_req` parameter is gone; calls are directly awaitables now * the async calls into a thread pool are gone and the thread pool is gone too (now useless) Closes: #15824 Closes: #5539 Related: #763 Related: #3696 * Fix empty line * remove more
This commit is contained in:
@@ -223,7 +223,7 @@ class ApiClient:
|
||||
|
||||
self.last_response = response_data
|
||||
|
||||
return_data = None # assuming derialization is not needed
|
||||
return_data = None # assuming deserialization is not needed
|
||||
# data needs deserialization or returns HTTP data (deserialized) only
|
||||
if _preload_content or _return_http_data_only:
|
||||
response_type = response_types_map.get(str(response_data.status), None)
|
||||
@@ -406,27 +406,28 @@ class ApiClient:
|
||||
If parameter async_req is False or missing,
|
||||
then the method will return the response directly.
|
||||
"""
|
||||
args = (
|
||||
resource_path,
|
||||
method,
|
||||
path_params,
|
||||
query_params,
|
||||
header_params,
|
||||
body,
|
||||
post_params,
|
||||
files,
|
||||
response_types_map,
|
||||
auth_settings,
|
||||
_return_http_data_only,
|
||||
collection_formats,
|
||||
_preload_content,
|
||||
_request_timeout,
|
||||
_host,
|
||||
_request_auth,
|
||||
)
|
||||
if not async_req:
|
||||
return self.__call_api(resource_path, method,
|
||||
path_params, query_params, header_params,
|
||||
body, post_params, files,
|
||||
response_types_map, auth_settings,
|
||||
_return_http_data_only, collection_formats,
|
||||
_preload_content, _request_timeout, _host,
|
||||
_request_auth)
|
||||
return self.__call_api(*args)
|
||||
|
||||
return self.pool.apply_async(self.__call_api, (resource_path,
|
||||
method, path_params,
|
||||
query_params,
|
||||
header_params, body,
|
||||
post_params, files,
|
||||
response_types_map,
|
||||
auth_settings,
|
||||
_return_http_data_only,
|
||||
collection_formats,
|
||||
_preload_content,
|
||||
_request_timeout,
|
||||
_host, _request_auth))
|
||||
return self.pool.apply_async(self.__call_api, args)
|
||||
|
||||
def request(self, method, url, query_params=None, headers=None,
|
||||
post_params=None, body=None, _preload_content=True,
|
||||
|
||||
Reference in New Issue
Block a user