diff --git a/example/example.py b/example/example.py index 620c23d..93a59c7 100755 --- a/example/example.py +++ b/example/example.py @@ -3,7 +3,6 @@ from regula.documentreader.webclient import * host = os.getenv("API_BASE_PATH", "https://api.regulaforensics.com") -regula_license = os.getenv("TEST_LICENSE", None) # optional, used here only for smoke test purposes # read optional local license file if os.path.isfile('regula.license') and os.access('regula.license', os.R_OK): @@ -21,7 +20,6 @@ uv_page_0 = f.read() with DocumentReaderApi(host) as api: - api.license = regula_license api.api_client.default_headers = { "X-CLIENT-KEY": "123", "Authorization": "Bearer 123" @@ -29,7 +27,7 @@ params = ProcessParams(already_cropped=True, scenario=Scenario.FULL_PROCESS) # Add license to request - # request = RecognitionRequest(system_info=ProcessSystemInfo(license="license"), process_params=params, images=[ + # request = RecognitionRequest(system_info=ProcessSystemInfo(license=base64.b64encode(regula_license).decode()), process_params=params, images=[ # RecognitionImage(image=white_page_0, light_index=Light.WHITE, page_index=0), # ]) diff --git a/regula/documentreader/webclient/ext/api/document_reader_api.py b/regula/documentreader/webclient/ext/api/document_reader_api.py index eb6acb9..2493a06 100755 --- a/regula/documentreader/webclient/ext/api/document_reader_api.py +++ b/regula/documentreader/webclient/ext/api/document_reader_api.py @@ -20,13 +20,9 @@ def __init__(self, host=None, debug=False, verify_ssl=True, api_client=None): configuration = Configuration(host=host) configuration.debug = debug configuration.verify_ssl = verify_ssl - self.api_client = ApiClient(configuration=configuration) - super().__init__(self.api_client) - self.__license = None - def __enter__(self): return self @@ -36,19 +32,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): def set_configuration(self, configuration) -> None: self.api_client.configuration = configuration - @property - def license(self) -> Base64String: - return self.__license - - @license.setter - def license(self, value: Union[Base64String, bytes]): - if isinstance(value, bytes): - self.__license = base64.b64encode(value).decode("utf-8") - else: - self.__license = value - def process(self, process_request: ProcessRequest) -> RecognitionResponse: - process_request.system_info.license = self.license return RecognitionResponse(self.api_process(process_request)) def deserialize_to_recognition_response(self, content: Union[bytes, bytearray, str]) -> RecognitionResponse: diff --git a/regula/documentreader/webclient/ext/models/recognition_request.py b/regula/documentreader/webclient/ext/models/recognition_request.py index 2296a12..2c57182 100755 --- a/regula/documentreader/webclient/ext/models/recognition_request.py +++ b/regula/documentreader/webclient/ext/models/recognition_request.py @@ -75,13 +75,17 @@ def __init__( else: input_images.append(image) super().__init__( - process_param=process_params, list=input_images, - system_info=system_info, tag=tag + process_param=process_params, + list=input_images, + system_info=system_info, + tag=tag ) if container_list: super().__init__( - process_param=process_params, container_list=container_list, - system_info=system_info, tag=tag + process_param=process_params, + container_list=container_list, + system_info=system_info, + tag=tag ) @property