added python static liveness check#425
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for Static Liveness Check functionality to the Yoti Python SDK, enabling identity verification using a single static image instead of the existing ZOOM liveness method that requires multiple frames and facemap data.
Key Changes
- Added
StaticLivenessResourceResponseandImageResponseclasses to handle static liveness resource retrieval - Extended
RequestedLivenessCheckBuilderwithfor_static_liveness()andwith_manual_check_never()methods for session creation - Updated
ResourceContainerto parse and filter static liveness resources alongside existing ZOOM resources
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| yoti_python_sdk/doc_scan/constants.py | Added STATIC constant for the new liveness type |
| yoti_python_sdk/doc_scan/session/create/check/liveness.py | Extended configuration and builder to support STATIC liveness type with optional manual_check parameter |
| yoti_python_sdk/doc_scan/session/retrieve/static_liveness_resource_response.py | New class to represent static liveness resources with image data |
| yoti_python_sdk/doc_scan/session/retrieve/image_response.py | New class to wrap image data containing media information for static liveness |
| yoti_python_sdk/doc_scan/session/retrieve/resource_container.py | Updated to parse STATIC type and added filter property for static liveness resources |
| yoti_python_sdk/tests/doc_scan/session/create/check/test_liveness_check.py | Added comprehensive tests for static liveness check creation and JSON serialization |
| yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.py | New test file covering static liveness resource parsing and media ID retrieval |
| examples/doc_scan/templates/success.html | Added UI section to display static liveness resources with collapsible accordion layout matching ZOOM liveness pattern |
Comments suppressed due to low confidence (2)
yoti_python_sdk/doc_scan/session/retrieve/static_liveness_resource_response.py:4
- Import of 'ResourceResponse' is not used.
from .resource_response import ResourceResponse
yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.py:2
- Import of 'json' is not used.
import json
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yoti_python_sdk/doc_scan/session/retrieve/static_liveness_resource_response.py
Outdated
Show resolved
Hide resolved
yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.py
Outdated
Show resolved
Hide resolved
yoti_python_sdk/tests/doc_scan/session/create/check/test_liveness_check.py
Show resolved
Hide resolved
nikhilPank
left a comment
There was a problem hiding this comment.
Looks good and it works locally.
There are a few cleanup recommendations from Copilot which could be implemented
…urce_response.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…veness_resource.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@mehmet-yoti I've opened a new pull request, #426, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
* Python library updates * added python static liveness check (#425) * update version files



Static Liveness Check Implementation
Overview
This implementation adds support for Static Liveness Check to the Yoti Python SDK, enabling identity verification using a single static image instead of the ZOOM liveness method which requires multiple frames and facemap data.
Features Added
1. Session Creation (Request Side)
Create STATIC Liveness Check
Generated JSON:
{ "type": "LIVENESS", "config": { "liveness_type": "STATIC", "manual_check": "NEVER", "max_retries": 3 } }2. Session Retrieval (Response Side)
Access STATIC Liveness Resources
3. Media Content Retrieval
Download STATIC Liveness Image
Run Tests
Example Application
The Flask example application (
examples/doc_scan/) now displays Static Liveness resources on the success page:Backward Compatibility
✅ Fully backward compatible - All existing code using ZOOM liveness continues to work without any changes:
Acceptance Criteria
All three acceptance criteria have been met:
✅ Add support for requesting a liveness check type STATIC
for_static_liveness()builder methodmanual_checkparameter (defaults to"NEVER")✅ Add support for retrieving the updated liveness check response
StaticLivenessResourceResponseclassstatic_liveness_resourcesfilter property✅ Ensure that the SDKs support retrieving the media for the STATIC liveness check
resource.image.media.idget_media_content()method works seamlesslyFor Existing Implementations
No changes required! Your existing ZOOM liveness code will continue to work. You can optionally add STATIC liveness support: