forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 5.0-sync-master
This commit is contained in:
33
samples/client/petstore/python-asyncio/.gitlab-ci.yml
Normal file
33
samples/client/petstore/python-asyncio/.gitlab-ci.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
# ref: https://docs.gitlab.com/ee/ci/README.html
|
||||
|
||||
stages:
|
||||
- test
|
||||
|
||||
.nosetest:
|
||||
stage: test
|
||||
script:
|
||||
- pip install -r requirements.txt
|
||||
- pip install -r test-requirements.txt
|
||||
- pytest --cov=petstore_api
|
||||
|
||||
nosetest-2.7:
|
||||
extends: .nosetest
|
||||
image: python:2.7-alpine
|
||||
nosetest-3.3:
|
||||
extends: .nosetest
|
||||
image: python:3.3-alpine
|
||||
nosetest-3.4:
|
||||
extends: .nosetest
|
||||
image: python:3.4-alpine
|
||||
nosetest-3.5:
|
||||
extends: .nosetest
|
||||
image: python:3.5-alpine
|
||||
nosetest-3.6:
|
||||
extends: .nosetest
|
||||
image: python:3.6-alpine
|
||||
nosetest-3.7:
|
||||
extends: .nosetest
|
||||
image: python:3.7-alpine
|
||||
nosetest-3.8:
|
||||
extends: .nosetest
|
||||
image: python:3.8-alpine
|
||||
@@ -1 +1,5 @@
|
||||
5.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
|
||||
@@ -10,6 +10,8 @@ python:
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
# command to install dependencies
|
||||
install: "pip install -r requirements.txt"
|
||||
install:
|
||||
- "pip install -r requirements.txt"
|
||||
- "pip install -r test-requirements.txt"
|
||||
# command to run tests
|
||||
script: nosetests
|
||||
script: pytest --cov=petstore_api
|
||||
|
||||
@@ -482,6 +482,7 @@ configuration.password = 'YOUR_PASSWORD'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
|
||||
@@ -31,6 +31,7 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
|
||||
@@ -35,6 +35,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
@@ -95,6 +96,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
@@ -159,6 +161,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
@@ -222,6 +225,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
@@ -287,6 +291,7 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
@@ -349,6 +354,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
@@ -411,6 +417,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
@@ -474,6 +481,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
@@ -538,6 +546,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
|
||||
@@ -90,6 +90,7 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
||||
|
||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with petstore_api.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
|
||||
@@ -18,7 +18,7 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
from petstore_api.exceptions import ( # noqa: F401
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
@@ -88,11 +88,17 @@ class AnotherFakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
|
||||
@@ -18,7 +18,7 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
from petstore_api.exceptions import ( # noqa: F401
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
@@ -88,11 +88,17 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['xml_item'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'xml_item'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -196,11 +202,17 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -300,11 +312,17 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -404,11 +422,17 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -508,11 +532,17 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -612,11 +642,17 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -720,11 +756,18 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['query', 'body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'query',
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -834,11 +877,17 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -972,11 +1021,30 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['number', 'double', 'pattern_without_delimiter', 'byte', 'integer', 'int32', 'int64', 'float', 'string', 'binary', 'date', 'date_time', 'password', 'param_callback'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'number',
|
||||
'double',
|
||||
'pattern_without_delimiter',
|
||||
'byte',
|
||||
'integer',
|
||||
'int32',
|
||||
'int64',
|
||||
'float',
|
||||
'string',
|
||||
'binary',
|
||||
'date',
|
||||
'date_time',
|
||||
'password',
|
||||
'param_callback'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -1160,11 +1228,24 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['enum_header_string_array', 'enum_header_string', 'enum_query_string_array', 'enum_query_string', 'enum_query_integer', 'enum_query_double', 'enum_form_string_array', 'enum_form_string'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'enum_header_string_array',
|
||||
'enum_header_string',
|
||||
'enum_query_string_array',
|
||||
'enum_query_string',
|
||||
'enum_query_integer',
|
||||
'enum_query_double',
|
||||
'enum_form_string_array',
|
||||
'enum_form_string'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -1291,11 +1372,22 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['required_string_group', 'required_boolean_group', 'required_int64_group', 'string_group', 'boolean_group', 'int64_group'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'required_string_group',
|
||||
'required_boolean_group',
|
||||
'required_int64_group',
|
||||
'string_group',
|
||||
'boolean_group',
|
||||
'int64_group'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -1411,11 +1503,17 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['param'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'param'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -1519,11 +1617,18 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['param', 'param2'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'param',
|
||||
'param2'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -1641,11 +1746,21 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['pipe', 'ioutil', 'http', 'url', 'context'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'pipe',
|
||||
'ioutil',
|
||||
'http',
|
||||
'url',
|
||||
'context'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
|
||||
@@ -18,7 +18,7 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
from petstore_api.exceptions import ( # noqa: F401
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
@@ -88,11 +88,17 @@ class FakeClassnameTags123Api(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
|
||||
@@ -18,7 +18,7 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
from petstore_api.exceptions import ( # noqa: F401
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
@@ -86,11 +86,17 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -194,11 +200,18 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['pet_id', 'api_key'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'pet_id',
|
||||
'api_key'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -300,11 +313,17 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['status'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'status'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -409,11 +428,17 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['tags'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'tags'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -518,11 +543,17 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['pet_id'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'pet_id'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -624,11 +655,17 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -734,11 +771,19 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['pet_id', 'name', 'status'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'pet_id',
|
||||
'name',
|
||||
'status'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -848,11 +893,19 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['pet_id', 'additional_metadata', 'file'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'pet_id',
|
||||
'additional_metadata',
|
||||
'file'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -966,11 +1019,19 @@ class PetApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['pet_id', 'required_file', 'additional_metadata'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'pet_id',
|
||||
'required_file',
|
||||
'additional_metadata'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
|
||||
@@ -18,7 +18,7 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
from petstore_api.exceptions import ( # noqa: F401
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
@@ -88,11 +88,17 @@ class StoreApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['order_id'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'order_id'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -190,11 +196,16 @@ class StoreApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = [] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -292,11 +303,17 @@ class StoreApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['order_id'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'order_id'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -402,11 +419,17 @@ class StoreApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
|
||||
@@ -18,7 +18,7 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
from petstore_api.exceptions import ( # noqa: F401
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
@@ -88,11 +88,17 @@ class UserApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -190,11 +196,17 @@ class UserApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -292,11 +304,17 @@ class UserApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -396,11 +414,17 @@ class UserApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['username'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'username'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -498,11 +522,17 @@ class UserApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['username'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'username'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -606,11 +636,18 @@ class UserApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['username', 'password'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'username',
|
||||
'password'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -716,11 +753,16 @@ class UserApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = [] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
@@ -816,11 +858,18 @@ class UserApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['username', 'body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
all_params = [
|
||||
'username',
|
||||
'body'
|
||||
]
|
||||
all_params.extend(
|
||||
[
|
||||
'async_req',
|
||||
'_return_http_data_only',
|
||||
'_preload_content',
|
||||
'_request_timeout'
|
||||
]
|
||||
)
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
|
||||
@@ -68,7 +68,7 @@ class ApiClient(object):
|
||||
def __init__(self, configuration=None, header_name=None, header_value=None,
|
||||
cookie=None, pool_threads=1):
|
||||
if configuration is None:
|
||||
configuration = Configuration()
|
||||
configuration = Configuration.get_default_copy()
|
||||
self.configuration = configuration
|
||||
self.pool_threads = pool_threads
|
||||
|
||||
@@ -81,13 +81,14 @@ class ApiClient(object):
|
||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||
self.client_side_validation = configuration.client_side_validation
|
||||
|
||||
def __enter__(self):
|
||||
async def __aenter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.close()
|
||||
async def __aexit__(self, exc_type, exc_value, traceback):
|
||||
await self.close()
|
||||
|
||||
def close(self):
|
||||
async def close(self):
|
||||
await self.rest_client.close()
|
||||
if self._pool:
|
||||
self._pool.close()
|
||||
self._pool.join()
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import copy
|
||||
import logging
|
||||
import sys
|
||||
import urllib3
|
||||
@@ -36,6 +37,17 @@ class Configuration(object):
|
||||
The dict value is an API key prefix when generating the auth data.
|
||||
:param username: Username for HTTP basic authentication
|
||||
:param password: Password for HTTP basic authentication
|
||||
:param discard_unknown_keys: Boolean value indicating whether to discard
|
||||
unknown properties. A server may send a response that includes additional
|
||||
properties that are not known by the client in the following scenarios:
|
||||
1. The OpenAPI document is incomplete, i.e. it does not match the server
|
||||
implementation.
|
||||
2. The client was generated using an older version of the OpenAPI document
|
||||
and the server has been upgraded since then.
|
||||
If a schema in the OpenAPI document defines the additionalProperties attribute,
|
||||
then all undeclared properties received by the server are injected into the
|
||||
additional properties map. In that case, there are undeclared properties, and
|
||||
nothing to discard.
|
||||
|
||||
:Example:
|
||||
|
||||
@@ -71,9 +83,12 @@ class Configuration(object):
|
||||
)
|
||||
"""
|
||||
|
||||
_default = None
|
||||
|
||||
def __init__(self, host="http://petstore.swagger.io:80/v2",
|
||||
api_key=None, api_key_prefix=None,
|
||||
username=None, password=None,
|
||||
discard_unknown_keys=False,
|
||||
):
|
||||
"""Constructor
|
||||
"""
|
||||
@@ -103,6 +118,7 @@ class Configuration(object):
|
||||
self.password = password
|
||||
"""Password for HTTP basic authentication
|
||||
"""
|
||||
self.discard_unknown_keys = discard_unknown_keys
|
||||
self.access_token = None
|
||||
"""access token for OAuth/Bearer
|
||||
"""
|
||||
@@ -165,6 +181,45 @@ class Configuration(object):
|
||||
# Disable client side validation
|
||||
self.client_side_validation = True
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
cls = self.__class__
|
||||
result = cls.__new__(cls)
|
||||
memo[id(self)] = result
|
||||
for k, v in self.__dict__.items():
|
||||
if k not in ('logger', 'logger_file_handler'):
|
||||
setattr(result, k, copy.deepcopy(v, memo))
|
||||
# shallow copy of loggers
|
||||
result.logger = copy.copy(self.logger)
|
||||
# use setters to configure loggers
|
||||
result.logger_file = self.logger_file
|
||||
result.debug = self.debug
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def set_default(cls, default):
|
||||
"""Set default instance of configuration.
|
||||
|
||||
It stores default configuration, which can be
|
||||
returned by get_default_copy method.
|
||||
|
||||
:param default: object of Configuration
|
||||
"""
|
||||
cls._default = copy.deepcopy(default)
|
||||
|
||||
@classmethod
|
||||
def get_default_copy(cls):
|
||||
"""Return new instance of configuration.
|
||||
|
||||
This method returns newly created, based on default constructor,
|
||||
object of Configuration class or returns a copy of default
|
||||
configuration passed by the set_default method.
|
||||
|
||||
:return: The configuration object.
|
||||
"""
|
||||
if cls._default is not None:
|
||||
return copy.deepcopy(cls._default)
|
||||
return Configuration()
|
||||
|
||||
@property
|
||||
def logger_file(self):
|
||||
"""The logger file.
|
||||
|
||||
@@ -18,7 +18,6 @@ import ssl
|
||||
|
||||
import aiohttp
|
||||
import certifi
|
||||
import asyncio
|
||||
# python 2 and python 3 compatibility library
|
||||
from six.moves.urllib.parse import urlencode
|
||||
|
||||
@@ -74,19 +73,16 @@ class RESTClientObject(object):
|
||||
ssl=ssl_context
|
||||
)
|
||||
|
||||
# https pool manager
|
||||
if configuration.proxy:
|
||||
self.pool_manager = aiohttp.ClientSession(
|
||||
connector=connector,
|
||||
proxy=configuration.proxy
|
||||
)
|
||||
else:
|
||||
self.pool_manager = aiohttp.ClientSession(
|
||||
connector=connector
|
||||
)
|
||||
self.proxy = configuration.proxy
|
||||
self.proxy_headers = configuration.proxy_headers
|
||||
|
||||
def __del__(self):
|
||||
asyncio.ensure_future(self.pool_manager.close())
|
||||
# https pool manager
|
||||
self.pool_manager = aiohttp.ClientSession(
|
||||
connector=connector
|
||||
)
|
||||
|
||||
async def close(self):
|
||||
await self.pool_manager.close()
|
||||
|
||||
async def request(self, method, url, query_params=None, headers=None,
|
||||
body=None, post_params=None, _preload_content=True,
|
||||
@@ -131,6 +127,11 @@ class RESTClientObject(object):
|
||||
"headers": headers
|
||||
}
|
||||
|
||||
if self.proxy:
|
||||
args["proxy"] = self.proxy
|
||||
if self.proxy_headers:
|
||||
args["proxy_headers"] = self.proxy_headers
|
||||
|
||||
if query_params:
|
||||
args["url"] += '?' + urlencode(query_params)
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
|
||||
import unittest
|
||||
import weakref
|
||||
|
||||
from tests.util import async_test
|
||||
import petstore_api
|
||||
|
||||
|
||||
class TestApiClient(unittest.TestCase):
|
||||
|
||||
@async_test
|
||||
async def test_context_manager_closes_client(self):
|
||||
|
||||
async with petstore_api.ApiClient() as client:
|
||||
# thread pool
|
||||
self.assertIsNotNone(client.pool)
|
||||
pool_ref = weakref.ref(client._pool)
|
||||
self.assertIsNotNone(pool_ref())
|
||||
# pool_manager
|
||||
self.assertFalse(client.rest_client.pool_manager.closed)
|
||||
rest_pool_ref = client.rest_client.pool_manager
|
||||
|
||||
self.assertIsNone(pool_ref())
|
||||
self.assertTrue(rest_pool_ref.closed)
|
||||
@@ -18,7 +18,7 @@ import petstore_api
|
||||
from petstore_api import Configuration
|
||||
from petstore_api.rest import ApiException
|
||||
|
||||
from .util import id_gen
|
||||
from .util import id_gen, async_test
|
||||
|
||||
import json
|
||||
|
||||
@@ -27,15 +27,6 @@ import urllib3
|
||||
HOST = 'http://localhost:80/v2'
|
||||
|
||||
|
||||
def async_test(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
coro = asyncio.coroutine(f)
|
||||
future = coro(*args, **kwargs)
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(future)
|
||||
return wrapper
|
||||
|
||||
|
||||
class TestPetApiTests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@@ -201,6 +192,19 @@ class TestPetApiTests(unittest.TestCase):
|
||||
except ApiException as e:
|
||||
self.assertEqual(404, e.status)
|
||||
|
||||
@async_test
|
||||
async def test_proxy(self):
|
||||
config = Configuration()
|
||||
# set not-existent proxy and catch an error to verify that
|
||||
# the client library (aiohttp) tried to use it.
|
||||
config.proxy = 'http://localhost:8080/proxy'
|
||||
async with petstore_api.ApiClient(config) as client:
|
||||
pet_api = petstore_api.PetApi(client)
|
||||
|
||||
with self.assertRaisesRegex(petstore_api.rest.aiohttp.client_exceptions.ClientProxyConnectionError,
|
||||
'Cannot connect to host localhost:8080'):
|
||||
await pet_api.get_pet_by_id(self.pet.id)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import logging
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# flake8: noqa
|
||||
|
||||
import asyncio
|
||||
import random
|
||||
|
||||
|
||||
@@ -8,4 +9,10 @@ def id_gen(bits=32):
|
||||
return int(random.getrandbits(bits))
|
||||
|
||||
|
||||
|
||||
def async_test(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
coro = asyncio.coroutine(f)
|
||||
future = coro(*args, **kwargs)
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(future)
|
||||
return wrapper
|
||||
|
||||
Reference in New Issue
Block a user