diff --git a/README.md b/README.md index 3f530381..a6bb0ed4 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Fingerprint Pro Server API allows you to get information about visitors and abou This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 3 -- Package version: 2.3.0 +- Package version: 2.4.0 - Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen ## Requirements. diff --git a/fingerprint_pro_server_api_sdk/api/fingerprint_api.py b/fingerprint_pro_server_api_sdk/api/fingerprint_api.py index dd067eb0..45ac8ffd 100644 --- a/fingerprint_pro_server_api_sdk/api/fingerprint_api.py +++ b/fingerprint_pro_server_api_sdk/api/fingerprint_api.py @@ -29,10 +29,10 @@ class FingerprintApi(object): Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, configuration=None): + def __init__(self, configuration=None, pool=None): if configuration is None: raise ValueError("Missing the required parameter `configuration` when calling `FingerprintApi`") # noqa: E501 - self.api_client = ApiClient(configuration) + self.api_client = ApiClient(configuration, pool=pool) def get_event(self, request_id, **kwargs): # noqa: E501 """Get event by requestId # noqa: E501 @@ -99,7 +99,7 @@ def get_event_with_http_info(self, request_id, **kwargs): # noqa: E501 path_params['request_id'] = params['request_id'] # noqa: E501 query_params = [] - query_params.append(('ii', 'fingerprint-pro-server-python-sdk/2.3.0')) + query_params.append(('ii', 'fingerprint-pro-server-python-sdk/2.4.0')) header_params = {} @@ -214,7 +214,7 @@ def get_visits_with_http_info(self, visitor_id, **kwargs): # noqa: E501 path_params['visitor_id'] = params['visitor_id'] # noqa: E501 query_params = [] - query_params.append(('ii', 'fingerprint-pro-server-python-sdk/2.3.0')) + query_params.append(('ii', 'fingerprint-pro-server-python-sdk/2.4.0')) if 'request_id' in params: query_params.append(('request_id', params['request_id'])) # noqa: E501 if 'linked_id' in params: diff --git a/fingerprint_pro_server_api_sdk/api_client.py b/fingerprint_pro_server_api_sdk/api_client.py index d1847161..c81ed6e0 100644 --- a/fingerprint_pro_server_api_sdk/api_client.py +++ b/fingerprint_pro_server_api_sdk/api_client.py @@ -13,7 +13,6 @@ import datetime import json import mimetypes -from multiprocessing.pool import ThreadPool import os import re import tempfile @@ -60,19 +59,27 @@ class ApiClient(object): } def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None): + cookie=None, pool=None): if configuration is None: configuration = Configuration() self.configuration = configuration - self.pool = ThreadPool() + if pool is None: + try: + from multiprocessing.pool import ThreadPool + self.pool = ThreadPool() + except ImportError: + from fingerprint_pro_server_api_sdk.dummy_pool import DummyPool + self.pool = DummyPool() + else: + self.pool = pool self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Swagger-Codegen/2.3.0/python' + self.user_agent = 'Swagger-Codegen/2.4.0/python' def __del__(self): self.pool.close() diff --git a/fingerprint_pro_server_api_sdk/configuration.py b/fingerprint_pro_server_api_sdk/configuration.py index 30333a02..42d3bac5 100644 --- a/fingerprint_pro_server_api_sdk/configuration.py +++ b/fingerprint_pro_server_api_sdk/configuration.py @@ -263,5 +263,5 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 3\n"\ - "SDK Package Version: 2.3.0".\ + "SDK Package Version: 2.4.0".\ format(env=sys.platform, pyversion=sys.version) \ No newline at end of file diff --git a/fingerprint_pro_server_api_sdk/dummy_pool.py b/fingerprint_pro_server_api_sdk/dummy_pool.py new file mode 100644 index 00000000..2d10d5c2 --- /dev/null +++ b/fingerprint_pro_server_api_sdk/dummy_pool.py @@ -0,0 +1,20 @@ +class DummyAsyncResult: + def __init__(self, value): + self.value = value + + def get(self): + return self.value + + +class DummyPool: + def apply_async(self, func, args=(), kwds={}, callback=None): + result = func(*args, **kwds) + if callback is not None: + callback(result) + return DummyAsyncResult(result) + + def close(self): + pass + + def join(self): + pass diff --git a/requirements.txt b/requirements.txt index 70c70f00..4c5e8293 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ certifi >= 14.05.14 six >= 1.10 python_dateutil >= 2.5.3 setuptools >= 21.0.0 -urllib3 >= 1.15.1 -python-dotenv \ No newline at end of file +urllib3<1.27,>=1.21.1 +python-dotenv diff --git a/setup.py b/setup.py index a0dd4f5e..91db115f 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "fingerprint-pro-server-api-sdk" -VERSION = "2.3.0" +VERSION = "2.4.0" # To install the library, run the following # # python setup.py install diff --git a/template/api.mustache b/template/api.mustache index abb3ffa0..955e761b 100644 --- a/template/api.mustache +++ b/template/api.mustache @@ -22,10 +22,10 @@ class {{classname}}(object): Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, configuration=None): + def __init__(self, configuration=None, pool=None): if configuration is None: raise ValueError("Missing the required parameter `configuration` when calling `{{classname}}`") # noqa: E501 - self.api_client = ApiClient(configuration) + self.api_client = ApiClient(configuration, pool=pool) {{#operation}} def {{operationId}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs): # noqa: E501 @@ -218,4 +218,4 @@ class {{classname}}(object): {{/responses}} raise e {{/operation}} -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/template/api_client.mustache b/template/api_client.mustache index 513f739e..ee01247f 100644 --- a/template/api_client.mustache +++ b/template/api_client.mustache @@ -5,7 +5,6 @@ from __future__ import absolute_import import datetime import json import mimetypes -from multiprocessing.pool import ThreadPool import os import re import tempfile @@ -55,12 +54,20 @@ class ApiClient(object): } def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None): + cookie=None, pool=None): if configuration is None: configuration = Configuration() self.configuration = configuration - self.pool = ThreadPool() + if pool is None: + try: + from multiprocessing.pool import ThreadPool + self.pool = ThreadPool() + except ImportError: + from {{packageName}}.dummy_pool import DummyPool + self.pool = DummyPool() + else: + self.pool = pool self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} if header_name is not None: diff --git a/template/requirements.mustache b/template/requirements.mustache new file mode 100644 index 00000000..4c5e8293 --- /dev/null +++ b/template/requirements.mustache @@ -0,0 +1,6 @@ +certifi >= 14.05.14 +six >= 1.10 +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3<1.27,>=1.21.1 +python-dotenv