Skip to content

create_face_liveness_session async

create_face_liveness_session(
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
    kms_key_id: Optional[KmsKeyId] = None,
    settings: Optional[CreateFaceLivenessSessionRequestSettings] = None,
    client_request_token: Optional[ClientRequestToken] = None,
) -> CreateFaceLivenessSessionResponse

This API operation initiates a Face Liveness session. It returns a SessionId, which you can use to start streaming Face Liveness video and get the results for a Face Liveness session.

You can use the OutputConfig option in the Settings parameter to provide an Amazon S3 bucket location. The Amazon S3 bucket stores reference images and audit images. If no Amazon S3 bucket is defined, raw bytes are sent instead.

You can use AuditImagesLimit to limit the number of audit images returned when GetFaceLivenessSessionResults is called. This number is between 0 and 4. By default, it is set to 0. The limit is best effort and based on the duration of the selfie-video.

You can use the ChallengePreferences option in the Settings parameter to choose between the 'FaceMovementAndLightChallenge' or FaceMovementChallenge' settings. See the Shared Responsibility page for details on guidance for which setting to choose between these two settings depending on your use case and preferences. This parameter is optional and if no parameter is provided, then the 'FaceMovementAndLightChallenge' settings is applied by default.

Parameters:

  • kms_key_id (Optional[KmsKeyId], default: None ) –

    The identifier for your AWS Key Management Service key (AWS KMS key). Used to encrypt audit images and reference images.

  • settings (Optional[CreateFaceLivenessSessionRequestSettings], default: None ) –

    A session settings object. It contains settings for the operation to be performed. For Face Liveness, it accepts OutputConfig and AuditImagesLimit.

  • client_request_token (Optional[ClientRequestToken], default: None ) –

    Idempotent token is used to recognize the Face Liveness request. If the same token is used with multiple CreateFaceLivenessSession requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.

Raises:

Source code in docs_src/capo_rekognition/_services/async_rekognition.py
async def create_face_liveness_session(
    self,
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
    kms_key_id: Optional["capo_rekognition.types.kms_key_id.KmsKeyId"] = None,
    settings: Optional[
        "capo_rekognition.types.create_face_liveness_session_request_settings.CreateFaceLivenessSessionRequestSettings"
    ] = None,
    client_request_token: Optional[
        "capo_rekognition.types.client_request_token.ClientRequestToken"
    ] = None,
) -> "capo_rekognition.types.create_face_liveness_session_response.CreateFaceLivenessSessionResponse":
    """<p>This API operation initiates a Face Liveness session. It returns a <code>SessionId</code>, which you can use to start streaming Face Liveness video and get the results for a Face Liveness session. </p> <p>You can use the <code>OutputConfig</code> option in the Settings parameter to provide an Amazon S3 bucket location. The Amazon S3 bucket stores reference images and audit images. If no Amazon S3 bucket is defined, raw bytes are sent instead. </p> <p>You can use <code>AuditImagesLimit</code> to limit the number of audit images returned when <code>GetFaceLivenessSessionResults</code> is called. This number is between 0 and 4. By default, it is set to 0. The limit is best effort and based on the duration of the selfie-video. </p> <p>You can use the <code>ChallengePreferences</code> option in the <code>Settings</code> parameter to choose between the 'FaceMovementAndLightChallenge' or FaceMovementChallenge' settings. See the <a href="https://docs.aws.amazon.com/rekognition/latest/dg/face-liveness-shared-responsibility-model.html">Shared Responsibility</a> page for details on guidance for which setting to choose between these two settings depending on your use case and preferences. This parameter is optional and if no parameter is provided, then the 'FaceMovementAndLightChallenge' settings is applied by default.</p>

    Args:
        kms_key_id: <p> The identifier for your AWS Key Management Service key (AWS KMS key). Used to encrypt audit images and reference images.</p>
        settings: <p>A session settings object. It contains settings for the operation to be performed. For Face Liveness, it accepts <code>OutputConfig</code> and <code>AuditImagesLimit</code>.</p>
        client_request_token: <p>Idempotent token is used to recognize the Face Liveness request. If the same token is used with multiple <code>CreateFaceLivenessSession</code> requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.</p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
        capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
        capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
        capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
        capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rekognition.types.create_face_liveness_session_request.CreateFaceLivenessSessionRequest]",
    ) -> AsyncOperationResponse[
        "capo_rekognition.types.create_face_liveness_session_response.CreateFaceLivenessSessionResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.create_face_liveness_session

        (
            output,
            http_response,
        ) = await capo_rekognition._operations.rekognition_service.create_face_liveness_session.async_create_face_liveness_session(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateFaceLivenessSession")
    )
    input_: capo_rekognition.types.create_face_liveness_session_request.CreateFaceLivenessSessionRequest = {}
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if settings is not None:
        input_["settings"] = settings
    if client_request_token is not None:
        input_["client_request_token"] = client_request_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output