Skip to content

Commit

Permalink
[SP-10497] add log decompression (#92)
Browse files Browse the repository at this point in the history
* add log decompression

* update certify
  • Loading branch information
dangost authored Aug 29, 2023
1 parent 5e84228 commit 79113fb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
certifi = "==2022.12.7"
certifi = "==2023.7.22"
six = ">=1.10"
python-dateutil = ">=2.5.3"
urllib3 = ">=1.15.1"
Expand Down
4 changes: 2 additions & 2 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import base64
import json
import zlib
from typing import Optional, List
from regula.documentreader.webclient import ImageQualityCheckList, OneCandidate
from regula.documentreader.webclient.ext.models.authenticity.authenticity_check_list import AuthenticityCheckList
Expand Down Expand Up @@ -72,6 +73,14 @@ def result_by_type(self, result_type: int) -> Optional[ResultItem]:
def results_by_type(self, result_type) -> List[ResultItem]:
return [r for r in self.low_lvl_response.container_list.list if r.result_type == result_type]

def log(self) -> Optional[str]:
log_base64 = self.low_lvl_response.log
if not log_base64:
return None
buffer = base64.b64decode(log_base64.encode("UTF-8"))
log_text = zlib.decompress(buffer).decode("UTF-8")
return log_text

def __eq__(self, other: object) -> bool:
if not isinstance(other, RecognitionResponse):
return False
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"regula",
],
install_requires=[
"certifi==2022.12.7",
"certifi==2023.7.22",
"python-dateutil==2.8.1",
"six==1.15.0",
"urllib3==1.26.5",
Expand Down

0 comments on commit 79113fb

Please sign in to comment.