Skip to content

Commit 5e84228

Browse files
[SP-10204] get raw request response (#91)
* update-clients_GetRawRequestResponse * add request & response json methods * update Pipfile * remove DS_Store * Update lockfile --------- Co-authored-by: GitHub Action <action@github.com>
1 parent 91fc10f commit 5e84228

File tree

6 files changed

+171
-168
lines changed

6 files changed

+171
-168
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
certifi = "==2022.6.15.1"
7+
certifi = "==2022.12.7"
88
six = ">=1.10"
99
python-dateutil = ">=2.5.3"
1010
urllib3 = ">=1.15.1"

Pipfile.lock

Lines changed: 153 additions & 166 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/example.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
])
4444
response = api.process(request)
4545

46+
request_json = request.json # example for request & response raw json
47+
response_json = response.json
48+
4649
# status examples
4750
response_status = response.status
4851
doc_overall_status = "valid" if response_status.overall_status == CheckResult.OK else "not valid"

regula/documentreader/webclient/ext/models/recognition_request.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import base64
23
from typing import List, Union
34

@@ -80,3 +81,7 @@ def __init__(
8081
process_param=process_params, container_list=container_list,
8182
system_info=ProcessSystemInfo(), tag=tag
8283
)
84+
85+
@property
86+
def json(self) -> str:
87+
return json.dumps(self.to_dict())

regula/documentreader/webclient/ext/models/recognition_response.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import base64
2+
import json
13
from typing import Optional, List
24
from regula.documentreader.webclient import ImageQualityCheckList, OneCandidate
35
from regula.documentreader.webclient.ext.models.authenticity.authenticity_check_list import AuthenticityCheckList
@@ -21,6 +23,10 @@ def text(self) -> Optional[Text]:
2123
return result.text
2224
return None
2325

26+
@property
27+
def json(self) -> str:
28+
return json.dumps(self.low_lvl_response.to_dict())
29+
2430
@property
2531
def status(self) -> Optional[Status]:
2632
result = self.result_by_type(Result.STATUS)

regula/documentreader/webclient/gen/models/scenario.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class Scenario(object):
4040

4141
MRZ_AND_LOCATE = "MrzAndLocate"
4242

43+
BARCODE_AND_LOCATE = "BarcodeAndLocate"
44+
4345
MRZ_OR_OCR = "MrzOrOcr"
4446

4547
MRZ_OR_BARCODE_OR_OCR = "MrzOrBarcodeOrOcr"
@@ -60,7 +62,7 @@ class Scenario(object):
6062

6163
CAPTURE = "Capture"
6264

63-
allowable_values = [MRZ, BARCODE, LOCATE, OCR, DOCTYPE, MRZ_OR_BARCODE, MRZ_OR_LOCATE, MRZ_AND_LOCATE, MRZ_OR_OCR, MRZ_OR_BARCODE_OR_OCR, LOCATE_VISUAL_AND_MRZ_OR_OCR, FULL_PROCESS, FULL_AUTH, ID3RUS, RUS_STAMP, OCR_FREE, CREDIT_CARD, CAPTURE] # noqa: E501
65+
allowable_values = [MRZ, BARCODE, LOCATE, OCR, DOCTYPE, MRZ_OR_BARCODE, MRZ_OR_LOCATE, MRZ_AND_LOCATE, BARCODE_AND_LOCATE, MRZ_OR_OCR, MRZ_OR_BARCODE_OR_OCR, LOCATE_VISUAL_AND_MRZ_OR_OCR, FULL_PROCESS, FULL_AUTH, ID3RUS, RUS_STAMP, OCR_FREE, CREDIT_CARD, CAPTURE] # noqa: E501
6466

6567
"""
6668
Attributes:

0 commit comments

Comments
 (0)