SDK-2781: Python - Add support for new capture_type property on Static Liveness resources - python#460
Conversation
… Static Liveness resources [python]
🤖 Claude Code ReviewCode Review FindingsCriticalNone MajorNone Minor
Nit
|
|
There was a problem hiding this comment.
Pull request overview
Adds support for the Doc Scan API’s new capture_type field on Static Liveness resources by parsing it into StaticLivenessResourceResponse and exposing it via a new capture_type property, with None as the default when absent.
Changes:
- Parse and store
capture_typeinStaticLivenessResourceResponseand expose it via a new@property. - Extend unit tests for static liveness parsing to cover present/missing
capture_typeandNonepayload input. - Add a
ResourceContainertest ensuringcapture_typeis available for static liveness resources and not present on zoom liveness resources.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| yoti_python_sdk/doc_scan/session/retrieve/static_liveness_resource_response.py | Parses capture_type from API payload and exposes it as a property on static liveness resources. |
| yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.py | Adds/updates tests covering capture_type parsing and edge cases (missing field, None data). |
| yoti_python_sdk/tests/doc_scan/session/retrieve/test_resource_container.py | Verifies capture_type is surfaced via ResourceContainer.static_liveness_resources and absent on zoom resources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Summary
Adds support for the new
capture_typeproperty on Static Liveness resources returned by the Doc Scan API. TheStaticLivenessResourceResponseclass now exposes acapture_typeattribute (e.g."PHOTOGRAPH") parsed from the API response, defaulting toNonewhen the field is absent.Changes
yoti_python_sdk/doc_scan/session/retrieve/static_liveness_resource_response.pycapture_typefrom the response payload in__init__usingdata.get("capture_type", None).capture_type@propertyexposing the value (returnsstrorNone).yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.pycapture_type == "PHOTOGRAPH".capture_type is Nonein the existing missing-image test.test_should_handle_missing_capture_typeandtest_should_handle_none_datato cover absent/empty payloads.yoti_python_sdk/tests/doc_scan/session/retrieve/test_resource_container.pytest_should_expose_capture_type_on_static_liveness_resourceverifying thatcapture_typeis wired throughResourceContainer.static_liveness_resourcesand is not present on non-static (Zoom) liveness resources.QA Test Steps
websdk-auto/SDK-2781-python-python---add-support-for-new-capture-type-property-on-static-liveness-resources.pip install -e .andpip install -r requirements.txt(or your usual install command).pytest yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.py -vpytest yoti_python_sdk/tests/doc_scan/session/retrieve/test_resource_container.py -vtest_should_parse_static_liveness_resource_response(assertscapture_type == "PHOTOGRAPH").test_should_handle_missing_capture_typeandtest_should_handle_none_data.test_should_expose_capture_type_on_static_liveness_resource.pytest yoti_python_sdk/tests/doc_scan/ -vStaticLivenessResourceResponse({"id": "x", "liveness_type": "STATIC"}).capture_typemust beNone.StaticLivenessResourceResponse(None).capture_typemust beNone(and.imagemust beNone).ResourceContainerwith aliveness_capturearray containing oneSTATICentry withcapture_typeand oneZOOMentry; confirmstatic_liveness_resources[0].capture_typereturns the expected value and the Zoom resource has nocapture_typeattribute.StaticLivenessResourceResponsefields (id,liveness_type,image,image.media.id) still parse correctly whencapture_typeis both present and absent.Notes
capture_typeis exposed as a plain string (e.g."PHOTOGRAPH") rather than an enum, mirroring how other backend-driven string fields (liveness_type, sourcetype, etc.) are handled in this SDK. If a canonical set of values is later defined, an enum could be added in a follow-up without breaking the public API.Nonewhen missing, preserving backwards compatibility with older API responses that do not includecapture_type.StaticLivenessResourceResponseis updated; other liveness resource types (e.g. Zoom) are intentionally untouched per the ticket scope.Related Jira: SDK-2781
Auto-generated by n8n + Claude CLI