Skip to content

Commit

Permalink
Merge pull request #32 from fingerprintjs/feat/aws-labmda-support
Browse files Browse the repository at this point in the history
Add AWS Labmda support INTER-161
  • Loading branch information
ilfa authored Aug 9, 2023
2 parents 30968e7 + 06dbbb7 commit e9220c4
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions fingerprint_pro_server_api_sdk/api/fingerprint_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {}

Expand Down Expand Up @@ -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:
Expand Down
15 changes: 11 additions & 4 deletions fingerprint_pro_server_api_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import datetime
import json
import mimetypes
from multiprocessing.pool import ThreadPool
import os
import re
import tempfile
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion fingerprint_pro_server_api_sdk/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
20 changes: 20 additions & 0 deletions fingerprint_pro_server_api_sdk/dummy_pool.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
urllib3<1.27,>=1.21.1
python-dotenv
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions template/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -218,4 +218,4 @@ class {{classname}}(object):
{{/responses}}
raise e
{{/operation}}
{{/operations}}
{{/operations}}
13 changes: 10 additions & 3 deletions template/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions template/requirements.mustache
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e9220c4

Please sign in to comment.