Skip to content

Commit e5b33ae

Browse files
committed
SDK-2792-python-add-support-for-retrieving-the-extraction-image-ids-field-from-the-idv-pages
1 parent d1d8e58 commit e5b33ae

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

yoti_python_sdk/doc_scan/session/retrieve/page_response.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def __init__(self, data=None):
2323
)
2424
self.__media = MediaResponse(data["media"]) if "media" in data.keys() else None
2525
self.__frames = [FrameResponse(frame) for frame in data.get("frames", [])]
26+
self.__extraction_image_ids = data.get("extraction_image_ids", [])
2627

2728
@property
2829
def capture_method(self):
@@ -53,3 +54,13 @@ def frames(self):
5354
:rtype: list[FrameResponse]
5455
"""
5556
return self.__frames
57+
58+
@property
59+
def extraction_image_ids(self):
60+
"""
61+
Returns the list of extraction image IDs
62+
63+
:return: the extraction image IDs
64+
:rtype: list[str]
65+
"""
66+
return self.__extraction_image_ids

yoti_python_sdk/tests/doc_scan/session/retrieve/test_page_response.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@
88
class PageResponseTest(unittest.TestCase):
99
SOME_CAPTURE_METHOD = "someCaptureMethod"
1010
SOME_FRAMES = [{"first": "frame"}, {"second": "frame"}]
11+
SOME_EXTRACTION_IMAGE_IDS = [
12+
"066a9372-0a52-4fe4-a026-866f8aee6fcb",
13+
"9b0c9c0a-ff30-41ed-815b-d95d63271d45",
14+
]
1115

1216
def test_should_parse_correctly(self):
1317
data = {
1418
"capture_method": self.SOME_CAPTURE_METHOD,
1519
"media": {},
1620
"frames": self.SOME_FRAMES,
21+
"extraction_image_ids": self.SOME_EXTRACTION_IMAGE_IDS,
1722
}
1823

1924
result = PageResponse(data)
@@ -23,13 +28,16 @@ def test_should_parse_correctly(self):
2328
assert len(result.frames) == 2
2429
assert isinstance(result.frames[0], FrameResponse)
2530
assert isinstance(result.frames[1], FrameResponse)
31+
assert len(result.extraction_image_ids) == 2
32+
assert result.extraction_image_ids == self.SOME_EXTRACTION_IMAGE_IDS
2633

2734
def test_should_parse_with_none(self):
2835
result = PageResponse(None)
2936

3037
assert result.capture_method is None
3138
assert result.media is None
3239
assert len(result.frames) == 0
40+
assert len(result.extraction_image_ids) == 0
3341

3442

3543
if __name__ == "__main__":

0 commit comments

Comments
 (0)