Partager via


FaceSessionClient Class

FaceSessionClient.

Inheritance
azure.ai.vision.face._client.FaceSessionClient
FaceSessionClient

Constructor

FaceSessionClient(endpoint: str, credential: AzureKeyCredential | TokenCredential, **kwargs: Any)

Parameters

Name Description
endpoint
Required
str

Supported Cognitive Services endpoints (protocol and hostname, for example: https://{resource-name}.cognitiveservices.azure.com). Required.

credential
Required

Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required.

Keyword-Only Parameters

Name Description
api_version

API Version. Default value is "v1.1-preview.1". Note that overriding this default value may result in unsupported behavior.

Methods

close
create_liveness_session

Create a new detect liveness session.

A session is best for client device scenarios where developers want to authorize a client device to perform only a liveness detection without granting full access to their resource. Created sessions have a limited life span and only authorize clients to perform the desired action before access is expired.

Permissions includes...

  • Ability to call /detectLiveness/singleModal for up to 3 retries.

  • A token lifetime of 10 minutes.

    [!NOTE] Client access can be revoked by deleting the session using the Delete Liveness Session

operation. To retrieve a result, use the Get Liveness Session. To audit the individual requests that a client has made to your resource, use the List Liveness Session Audit Entries.

create_liveness_with_verify_session

Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.

A session is best for client device scenarios where developers want to authorize a client device to perform only a liveness detection without granting full access to their resource. Created sessions have a limited life span and only authorize clients to perform the desired action before access is expired.

Permissions includes...

  • Ability to call /detectLivenessWithVerify/singleModal for up to 3 retries.

  • A token lifetime of 10 minutes.

    [!NOTE]

    • Client access can be revoked by deleting the session using the Delete Liveness With Verify

Session operation.

  • To retrieve a result, use the Get Liveness With Verify Session.

  • To audit the individual requests that a client has made to your resource, use the List

Liveness With Verify Session Audit Entries.

Alternative Option: Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.

[!NOTE] Extra measures should be taken to validate that the client is sending the expected

VerifyImage.

delete_liveness_session

Delete all session related information for matching the specified session id.

[!NOTE] Deleting a session deactivates the Session Auth Token by blocking future API calls made with

that Auth Token. While this can be used to remove any access for that token, those requests will still count towards overall resource rate limits. It's best to leverage TokenTTL to limit length of tokens in the case that it is misused.

delete_liveness_with_verify_session

Delete all session related information for matching the specified session id.

[!NOTE] Deleting a session deactivates the Session Auth Token by blocking future API calls made with

that Auth Token. While this can be used to remove any access for that token, those requests will still count towards overall resource rate limits. It's best to leverage TokenTTL to limit length of tokens in the case that it is misused.

get_liveness_session_audit_entries

Gets session requests and response body for the session.

get_liveness_session_result

Get session result of detectLiveness/singleModal call.

get_liveness_sessions

Lists sessions for /detectLiveness/SingleModal.

List sessions from the last sessionId greater than the 'start'.

The result should be ordered by sessionId in ascending order.

get_liveness_with_verify_session_audit_entries

Gets session requests and response body for the session.

get_liveness_with_verify_session_result

Get session result of detectLivenessWithVerify/singleModal call.

get_liveness_with_verify_sessions

Lists sessions for /detectLivenessWithVerify/SingleModal.

List sessions from the last sessionId greater than the "start".

The result should be ordered by sessionId in ascending order.

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

close

close() -> None

create_liveness_session

Create a new detect liveness session.

A session is best for client device scenarios where developers want to authorize a client device to perform only a liveness detection without granting full access to their resource. Created sessions have a limited life span and only authorize clients to perform the desired action before access is expired.

Permissions includes...

  • Ability to call /detectLiveness/singleModal for up to 3 retries.

  • A token lifetime of 10 minutes.

    [!NOTE] Client access can be revoked by deleting the session using the Delete Liveness Session

operation. To retrieve a result, use the Get Liveness Session. To audit the individual requests that a client has made to your resource, use the List Liveness Session Audit Entries.

create_liveness_session(body: CreateLivenessSessionContent | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> CreateLivenessSessionResult

Parameters

Name Description
body
Required

Is one of the following types: CreateLivenessSessionContent, JSON, IO[bytes] Required.

Returns

Type Description

CreateLivenessSessionResult. The CreateLivenessSessionResult is compatible with MutableMapping

Exceptions

Type Description

Examples


   # JSON input template you can fill out and use as your body input.
   body = {
       "livenessOperationMode": "str",  # Type of liveness mode the client should
         follow. Required. Known values are: "Passive" and "PassiveActive".
       "authTokenTimeToLiveInSeconds": 0,  # Optional. Seconds the session should
         last for. Range is 60 to 86400 seconds. Default value is 600.
       "deviceCorrelationId": "str",  # Optional. Unique Guid per each end-user
         device. This is to provide rate limiting and anti-hammering. If
         'deviceCorrelationIdSetInClient' is true in this request, this
         'deviceCorrelationId' must be null.
       "deviceCorrelationIdSetInClient": bool,  # Optional. Whether or not to allow
         client to set their own 'deviceCorrelationId' via the Vision SDK. Default is
         false, and 'deviceCorrelationId' must be set in this request body.
       "sendResultsToClient": bool  # Optional. Whether or not to allow a '200 -
         Success' response body to be sent to the client, which may be undesirable for
         security reasons. Default is false, clients will receive a '204 - NoContent'
         empty body response. Regardless of selection, calling Session GetResult will
         always contain a response body enabling business logic to be implemented.
   }

   # response body for status code(s): 200
   response == {
       "authToken": "str",  # Bearer token to provide authentication for the Vision
         SDK running on a client application. This Bearer token has limited permissions to
         perform only the required action and expires after the TTL time. It is also
         auditable. Required.
       "sessionId": "str"  # The unique session ID of the created session. It will
         expire 48 hours after it was created or may be deleted sooner using the
         corresponding Session DELETE operation. Required.
   }

create_liveness_with_verify_session

Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.

A session is best for client device scenarios where developers want to authorize a client device to perform only a liveness detection without granting full access to their resource. Created sessions have a limited life span and only authorize clients to perform the desired action before access is expired.

Permissions includes...

  • Ability to call /detectLivenessWithVerify/singleModal for up to 3 retries.

  • A token lifetime of 10 minutes.

    [!NOTE]

    • Client access can be revoked by deleting the session using the Delete Liveness With Verify

Session operation.

  • To retrieve a result, use the Get Liveness With Verify Session.

  • To audit the individual requests that a client has made to your resource, use the List

Liveness With Verify Session Audit Entries.

Alternative Option: Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.

[!NOTE] Extra measures should be taken to validate that the client is sending the expected

VerifyImage.

create_liveness_with_verify_session(body: _models.CreateLivenessSessionContent, *, verify_image: bytes | None, content_type: str = 'application/json', **kwargs: Any) -> _models.CreateLivenessWithVerifySessionResult

Parameters

Name Description
body
Required

Is one of the following types: CreateLivenessSessionContent, JSON, IO[bytes] Required.

Keyword-Only Parameters

Name Description
verify_image
bytes or None

The image for verify. If you don't have any images to use for verification, set it to None. Required.

Returns

Type Description

CreateLivenessWithVerifySessionResult. The CreateLivenessWithVerifySessionResult is compatible with MutableMapping

Exceptions

Type Description

Examples


   # JSON input template you can fill out and use as your body input.
   body = {
       "livenessOperationMode": "str",  # Type of liveness mode the client should
         follow. Required. "Passive"
       "authTokenTimeToLiveInSeconds": 0,  # Optional. Seconds the session should
         last for. Range is 60 to 86400 seconds. Default value is 600.
       "deviceCorrelationId": "str",  # Optional. Unique Guid per each end-user
         device. This is to provide rate limiting and anti-hammering. If
         'deviceCorrelationIdSetInClient' is true in this request, this
         'deviceCorrelationId' must be null.
       "deviceCorrelationIdSetInClient": bool,  # Optional. Whether or not to allow
         client to set their own 'deviceCorrelationId' via the Vision SDK. Default is
         false, and 'deviceCorrelationId' must be set in this request body.
       "sendResultsToClient": bool  # Optional. Whether or not to allow a '200 -
         Success' response body to be sent to the client, which may be undesirable for
         security reasons. Default is false, clients will receive a '204 - NoContent'
         empty body response. Regardless of selection, calling Session GetResult will
         always contain a response body enabling business logic to be implemented.
   }

   # response body for status code(s): 200
   response == {
       "authToken": "str",  # Bearer token to provide authentication for the Vision
         SDK running on a client application. This Bearer token has limited permissions to
         perform only the required action and expires after the TTL time. It is also
         auditable. Required.
       "sessionId": "str"  # The unique session ID of the created session. It will
         expire 48 hours after it was created or may be deleted sooner using the
         corresponding Session DELETE operation. Required.
   }

delete_liveness_session

Delete all session related information for matching the specified session id.

[!NOTE] Deleting a session deactivates the Session Auth Token by blocking future API calls made with

that Auth Token. While this can be used to remove any access for that token, those requests will still count towards overall resource rate limits. It's best to leverage TokenTTL to limit length of tokens in the case that it is misused.

delete_liveness_session(session_id: str, **kwargs: Any) -> None

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Returns

Type Description

None

Exceptions

Type Description

delete_liveness_with_verify_session

Delete all session related information for matching the specified session id.

[!NOTE] Deleting a session deactivates the Session Auth Token by blocking future API calls made with

that Auth Token. While this can be used to remove any access for that token, those requests will still count towards overall resource rate limits. It's best to leverage TokenTTL to limit length of tokens in the case that it is misused.

delete_liveness_with_verify_session(session_id: str, **kwargs: Any) -> None

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Returns

Type Description

None

Exceptions

Type Description

get_liveness_session_audit_entries

Gets session requests and response body for the session.

get_liveness_session_audit_entries(session_id: str, *, start: str | None = None, top: int | None = None, **kwargs: Any) -> List[LivenessSessionAuditEntry]

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Keyword-Only Parameters

Name Description
start
str

List resources greater than the "start". It contains no more than 64 characters. Default is empty. Default value is None.

top
int

The number of items to list, ranging in [1, 1000]. Default is 1000. Default value is None.

Returns

Type Description

list of LivenessSessionAuditEntry

Exceptions

Type Description

Examples


   # response body for status code(s): 200
   response == [
       {
           "clientRequestId": "str",  # The unique clientRequestId that is sent
             by the client in the 'client-request-id' header. Required.
           "digest": "str",  # The server calculated digest for this request. If
             the client reported digest differs from the server calculated digest, then
             the message integrity between the client and service has been compromised and
             the result should not be trusted. For more information, see how to guides on
             how to leverage this value to secure your end-to-end solution. Required.
           "id": 0,  # The unique id to refer to this audit request. Use this id
             with the 'start' query parameter to continue on to the next page of audit
             results. Required.
           "receivedDateTime": "2020-02-20 00:00:00",  # The UTC DateTime that
             the request was received. Required.
           "request": {
               "contentType": "str",  # The content type of the request.
                 Required.
               "method": "str",  # The HTTP method of the request (i.e.,
                 GET, POST, DELETE). Required.
               "url": "str",  # The relative URL and query of the liveness
                 request. Required.
               "contentLength": 0,  # Optional. The length of the request
                 body in bytes.
               "userAgent": "str"  # Optional. The user agent used to submit
                 the request.
           },
           "requestId": "str",  # The unique requestId that is returned by the
             service to the client in the 'apim-request-id' header. Required.
           "response": {
               "body": {
                   "livenessDecision": "str",  # Optional. The liveness
                     classification for the target face. Known values are: "uncertain",
                     "realface", and "spoofface".
                   "modelVersionUsed": "str",  # Optional. The model
                     version used for liveness classification. Known values are:
                     "2020-02-15-preview.01", "2021-11-12-preview.03",
                     "2022-10-15-preview.04", and "2023-03-02-preview.05".
                   "target": {
                       "faceRectangle": {
                           "height": 0,  # The height of the
                             rectangle, in pixels. Required.
                           "left": 0,  # The distance from the
                             left edge if the image to the left edge of the rectangle, in
                             pixels. Required.
                           "top": 0,  # The distance from the
                             top edge if the image to the top edge of the rectangle, in
                             pixels. Required.
                           "width": 0  # The width of the
                             rectangle, in pixels. Required.
                       },
                       "fileName": "str",  # The file name which
                         contains the face rectangle where the liveness classification was
                         made on. Required.
                       "imageType": "str",  # The image type which
                         contains the face rectangle where the liveness classification was
                         made on. Required. Known values are: "Color", "Infrared", and
                         "Depth".
                       "timeOffsetWithinFile": 0  # The time offset
                         within the file of the frame which contains the face rectangle
                         where the liveness classification was made on. Required.
                   },
                   "verifyResult": {
                       "isIdentical": bool,  # Whether the target
                         liveness face and comparison image face match. Required.
                       "matchConfidence": 0.0,  # The target face
                         liveness face and comparison image face verification confidence.
                         Required.
                       "verifyImage": {
                           "faceRectangle": {
                               "height": 0,  # The height of
                                 the rectangle, in pixels. Required.
                               "left": 0,  # The distance
                                 from the left edge if the image to the left edge of the
                                 rectangle, in pixels. Required.
                               "top": 0,  # The distance
                                 from the top edge if the image to the top edge of the
                                 rectangle, in pixels. Required.
                               "width": 0  # The width of
                                 the rectangle, in pixels. Required.
                           },
                           "qualityForRecognition": "str"  #
                             Quality of face image for recognition. Required. Known values
                             are: "low", "medium", and "high".
                       }
                   }
               },
               "latencyInMilliseconds": 0,  # The server measured latency
                 for this request in milliseconds. Required.
               "statusCode": 0  # The HTTP status code returned to the
                 client. Required.
           },
           "sessionId": "str"  # The unique sessionId of the created session. It
             will expire 48 hours after it was created or may be deleted sooner using the
             corresponding session DELETE operation. Required.
       }
   ]

get_liveness_session_result

Get session result of detectLiveness/singleModal call.

get_liveness_session_result(session_id: str, **kwargs: Any) -> LivenessSession

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Returns

Type Description

LivenessSession. The LivenessSession is compatible with MutableMapping

Exceptions

Type Description

Examples


   # response body for status code(s): 200
   response == {
       "createdDateTime": "2020-02-20 00:00:00",  # DateTime when this session was
         created. Required.
       "id": "str",  # The unique ID to reference this session. Required.
       "sessionExpired": bool,  # Whether or not the session is expired. Required.
       "status": "str",  # The current status of the session. Required. Known values
         are: "NotStarted", "Started", and "ResultAvailable".
       "authTokenTimeToLiveInSeconds": 0,  # Optional. Seconds the session should
         last for. Range is 60 to 86400 seconds. Default value is 600.
       "deviceCorrelationId": "str",  # Optional. Unique Guid per each end-user
         device. This is to provide rate limiting and anti-hammering. If
         'deviceCorrelationIdSetInClient' is true in this request, this
         'deviceCorrelationId' must be null.
       "result": {
           "clientRequestId": "str",  # The unique clientRequestId that is sent
             by the client in the 'client-request-id' header. Required.
           "digest": "str",  # The server calculated digest for this request. If
             the client reported digest differs from the server calculated digest, then
             the message integrity between the client and service has been compromised and
             the result should not be trusted. For more information, see how to guides on
             how to leverage this value to secure your end-to-end solution. Required.
           "id": 0,  # The unique id to refer to this audit request. Use this id
             with the 'start' query parameter to continue on to the next page of audit
             results. Required.
           "receivedDateTime": "2020-02-20 00:00:00",  # The UTC DateTime that
             the request was received. Required.
           "request": {
               "contentType": "str",  # The content type of the request.
                 Required.
               "method": "str",  # The HTTP method of the request (i.e.,
                 GET, POST, DELETE). Required.
               "url": "str",  # The relative URL and query of the liveness
                 request. Required.
               "contentLength": 0,  # Optional. The length of the request
                 body in bytes.
               "userAgent": "str"  # Optional. The user agent used to submit
                 the request.
           },
           "requestId": "str",  # The unique requestId that is returned by the
             service to the client in the 'apim-request-id' header. Required.
           "response": {
               "body": {
                   "livenessDecision": "str",  # Optional. The liveness
                     classification for the target face. Known values are: "uncertain",
                     "realface", and "spoofface".
                   "modelVersionUsed": "str",  # Optional. The model
                     version used for liveness classification. Known values are:
                     "2020-02-15-preview.01", "2021-11-12-preview.03",
                     "2022-10-15-preview.04", and "2023-03-02-preview.05".
                   "target": {
                       "faceRectangle": {
                           "height": 0,  # The height of the
                             rectangle, in pixels. Required.
                           "left": 0,  # The distance from the
                             left edge if the image to the left edge of the rectangle, in
                             pixels. Required.
                           "top": 0,  # The distance from the
                             top edge if the image to the top edge of the rectangle, in
                             pixels. Required.
                           "width": 0  # The width of the
                             rectangle, in pixels. Required.
                       },
                       "fileName": "str",  # The file name which
                         contains the face rectangle where the liveness classification was
                         made on. Required.
                       "imageType": "str",  # The image type which
                         contains the face rectangle where the liveness classification was
                         made on. Required. Known values are: "Color", "Infrared", and
                         "Depth".
                       "timeOffsetWithinFile": 0  # The time offset
                         within the file of the frame which contains the face rectangle
                         where the liveness classification was made on. Required.
                   },
                   "verifyResult": {
                       "isIdentical": bool,  # Whether the target
                         liveness face and comparison image face match. Required.
                       "matchConfidence": 0.0,  # The target face
                         liveness face and comparison image face verification confidence.
                         Required.
                       "verifyImage": {
                           "faceRectangle": {
                               "height": 0,  # The height of
                                 the rectangle, in pixels. Required.
                               "left": 0,  # The distance
                                 from the left edge if the image to the left edge of the
                                 rectangle, in pixels. Required.
                               "top": 0,  # The distance
                                 from the top edge if the image to the top edge of the
                                 rectangle, in pixels. Required.
                               "width": 0  # The width of
                                 the rectangle, in pixels. Required.
                           },
                           "qualityForRecognition": "str"  #
                             Quality of face image for recognition. Required. Known values
                             are: "low", "medium", and "high".
                       }
                   }
               },
               "latencyInMilliseconds": 0,  # The server measured latency
                 for this request in milliseconds. Required.
               "statusCode": 0  # The HTTP status code returned to the
                 client. Required.
           },
           "sessionId": "str"  # The unique sessionId of the created session. It
             will expire 48 hours after it was created or may be deleted sooner using the
             corresponding session DELETE operation. Required.
       },
       "sessionStartDateTime": "2020-02-20 00:00:00"  # Optional. DateTime when this
         session was started by the client.
   }

get_liveness_sessions

Lists sessions for /detectLiveness/SingleModal.

List sessions from the last sessionId greater than the 'start'.

The result should be ordered by sessionId in ascending order.

get_liveness_sessions(*, start: str | None = None, top: int | None = None, **kwargs: Any) -> List[LivenessSessionItem]

Keyword-Only Parameters

Name Description
start
str

List resources greater than the "start". It contains no more than 64 characters. Default is empty. Default value is None.

top
int

The number of items to list, ranging in [1, 1000]. Default is 1000. Default value is None.

Returns

Type Description

list of LivenessSessionItem

Exceptions

Type Description

Examples


   # response body for status code(s): 200
   response == [
       {
           "createdDateTime": "2020-02-20 00:00:00",  # DateTime when this
             session was created. Required.
           "id": "str",  # The unique ID to reference this session. Required.
           "sessionExpired": bool,  # Whether or not the session is expired.
             Required.
           "authTokenTimeToLiveInSeconds": 0,  # Optional. Seconds the session
             should last for. Range is 60 to 86400 seconds. Default value is 600.
           "deviceCorrelationId": "str",  # Optional. Unique Guid per each
             end-user device. This is to provide rate limiting and anti-hammering. If
             'deviceCorrelationIdSetInClient' is true in this request, this
             'deviceCorrelationId' must be null.
           "sessionStartDateTime": "2020-02-20 00:00:00"  # Optional. DateTime
             when this session was started by the client.
       }
   ]

get_liveness_with_verify_session_audit_entries

Gets session requests and response body for the session.

get_liveness_with_verify_session_audit_entries(session_id: str, *, start: str | None = None, top: int | None = None, **kwargs: Any) -> List[LivenessSessionAuditEntry]

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Keyword-Only Parameters

Name Description
start
str

List resources greater than the "start". It contains no more than 64 characters. Default is empty. Default value is None.

top
int

The number of items to list, ranging in [1, 1000]. Default is 1000. Default value is None.

Returns

Type Description

list of LivenessSessionAuditEntry

Exceptions

Type Description

Examples


   # response body for status code(s): 200
   response == [
       {
           "clientRequestId": "str",  # The unique clientRequestId that is sent
             by the client in the 'client-request-id' header. Required.
           "digest": "str",  # The server calculated digest for this request. If
             the client reported digest differs from the server calculated digest, then
             the message integrity between the client and service has been compromised and
             the result should not be trusted. For more information, see how to guides on
             how to leverage this value to secure your end-to-end solution. Required.
           "id": 0,  # The unique id to refer to this audit request. Use this id
             with the 'start' query parameter to continue on to the next page of audit
             results. Required.
           "receivedDateTime": "2020-02-20 00:00:00",  # The UTC DateTime that
             the request was received. Required.
           "request": {
               "contentType": "str",  # The content type of the request.
                 Required.
               "method": "str",  # The HTTP method of the request (i.e.,
                 GET, POST, DELETE). Required.
               "url": "str",  # The relative URL and query of the liveness
                 request. Required.
               "contentLength": 0,  # Optional. The length of the request
                 body in bytes.
               "userAgent": "str"  # Optional. The user agent used to submit
                 the request.
           },
           "requestId": "str",  # The unique requestId that is returned by the
             service to the client in the 'apim-request-id' header. Required.
           "response": {
               "body": {
                   "livenessDecision": "str",  # Optional. The liveness
                     classification for the target face. Known values are: "uncertain",
                     "realface", and "spoofface".
                   "modelVersionUsed": "str",  # Optional. The model
                     version used for liveness classification. Known values are:
                     "2020-02-15-preview.01", "2021-11-12-preview.03",
                     "2022-10-15-preview.04", and "2023-03-02-preview.05".
                   "target": {
                       "faceRectangle": {
                           "height": 0,  # The height of the
                             rectangle, in pixels. Required.
                           "left": 0,  # The distance from the
                             left edge if the image to the left edge of the rectangle, in
                             pixels. Required.
                           "top": 0,  # The distance from the
                             top edge if the image to the top edge of the rectangle, in
                             pixels. Required.
                           "width": 0  # The width of the
                             rectangle, in pixels. Required.
                       },
                       "fileName": "str",  # The file name which
                         contains the face rectangle where the liveness classification was
                         made on. Required.
                       "imageType": "str",  # The image type which
                         contains the face rectangle where the liveness classification was
                         made on. Required. Known values are: "Color", "Infrared", and
                         "Depth".
                       "timeOffsetWithinFile": 0  # The time offset
                         within the file of the frame which contains the face rectangle
                         where the liveness classification was made on. Required.
                   },
                   "verifyResult": {
                       "isIdentical": bool,  # Whether the target
                         liveness face and comparison image face match. Required.
                       "matchConfidence": 0.0,  # The target face
                         liveness face and comparison image face verification confidence.
                         Required.
                       "verifyImage": {
                           "faceRectangle": {
                               "height": 0,  # The height of
                                 the rectangle, in pixels. Required.
                               "left": 0,  # The distance
                                 from the left edge if the image to the left edge of the
                                 rectangle, in pixels. Required.
                               "top": 0,  # The distance
                                 from the top edge if the image to the top edge of the
                                 rectangle, in pixels. Required.
                               "width": 0  # The width of
                                 the rectangle, in pixels. Required.
                           },
                           "qualityForRecognition": "str"  #
                             Quality of face image for recognition. Required. Known values
                             are: "low", "medium", and "high".
                       }
                   }
               },
               "latencyInMilliseconds": 0,  # The server measured latency
                 for this request in milliseconds. Required.
               "statusCode": 0  # The HTTP status code returned to the
                 client. Required.
           },
           "sessionId": "str"  # The unique sessionId of the created session. It
             will expire 48 hours after it was created or may be deleted sooner using the
             corresponding session DELETE operation. Required.
       }
   ]

get_liveness_with_verify_session_result

Get session result of detectLivenessWithVerify/singleModal call.

get_liveness_with_verify_session_result(session_id: str, **kwargs: Any) -> LivenessWithVerifySession

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Returns

Type Description

LivenessWithVerifySession. The LivenessWithVerifySession is compatible with MutableMapping

Exceptions

Type Description

Examples


   # response body for status code(s): 200
   response == {
       "createdDateTime": "2020-02-20 00:00:00",  # DateTime when this session was
         created. Required.
       "id": "str",  # The unique ID to reference this session. Required.
       "sessionExpired": bool,  # Whether or not the session is expired. Required.
       "status": "str",  # The current status of the session. Required. Known values
         are: "NotStarted", "Started", and "ResultAvailable".
       "authTokenTimeToLiveInSeconds": 0,  # Optional. Seconds the session should
         last for. Range is 60 to 86400 seconds. Default value is 600.
       "deviceCorrelationId": "str",  # Optional. Unique Guid per each end-user
         device. This is to provide rate limiting and anti-hammering. If
         'deviceCorrelationIdSetInClient' is true in this request, this
         'deviceCorrelationId' must be null.
       "result": {
           "clientRequestId": "str",  # The unique clientRequestId that is sent
             by the client in the 'client-request-id' header. Required.
           "digest": "str",  # The server calculated digest for this request. If
             the client reported digest differs from the server calculated digest, then
             the message integrity between the client and service has been compromised and
             the result should not be trusted. For more information, see how to guides on
             how to leverage this value to secure your end-to-end solution. Required.
           "id": 0,  # The unique id to refer to this audit request. Use this id
             with the 'start' query parameter to continue on to the next page of audit
             results. Required.
           "receivedDateTime": "2020-02-20 00:00:00",  # The UTC DateTime that
             the request was received. Required.
           "request": {
               "contentType": "str",  # The content type of the request.
                 Required.
               "method": "str",  # The HTTP method of the request (i.e.,
                 GET, POST, DELETE). Required.
               "url": "str",  # The relative URL and query of the liveness
                 request. Required.
               "contentLength": 0,  # Optional. The length of the request
                 body in bytes.
               "userAgent": "str"  # Optional. The user agent used to submit
                 the request.
           },
           "requestId": "str",  # The unique requestId that is returned by the
             service to the client in the 'apim-request-id' header. Required.
           "response": {
               "body": {
                   "livenessDecision": "str",  # Optional. The liveness
                     classification for the target face. Known values are: "uncertain",
                     "realface", and "spoofface".
                   "modelVersionUsed": "str",  # Optional. The model
                     version used for liveness classification. Known values are:
                     "2020-02-15-preview.01", "2021-11-12-preview.03",
                     "2022-10-15-preview.04", and "2023-03-02-preview.05".
                   "target": {
                       "faceRectangle": {
                           "height": 0,  # The height of the
                             rectangle, in pixels. Required.
                           "left": 0,  # The distance from the
                             left edge if the image to the left edge of the rectangle, in
                             pixels. Required.
                           "top": 0,  # The distance from the
                             top edge if the image to the top edge of the rectangle, in
                             pixels. Required.
                           "width": 0  # The width of the
                             rectangle, in pixels. Required.
                       },
                       "fileName": "str",  # The file name which
                         contains the face rectangle where the liveness classification was
                         made on. Required.
                       "imageType": "str",  # The image type which
                         contains the face rectangle where the liveness classification was
                         made on. Required. Known values are: "Color", "Infrared", and
                         "Depth".
                       "timeOffsetWithinFile": 0  # The time offset
                         within the file of the frame which contains the face rectangle
                         where the liveness classification was made on. Required.
                   },
                   "verifyResult": {
                       "isIdentical": bool,  # Whether the target
                         liveness face and comparison image face match. Required.
                       "matchConfidence": 0.0,  # The target face
                         liveness face and comparison image face verification confidence.
                         Required.
                       "verifyImage": {
                           "faceRectangle": {
                               "height": 0,  # The height of
                                 the rectangle, in pixels. Required.
                               "left": 0,  # The distance
                                 from the left edge if the image to the left edge of the
                                 rectangle, in pixels. Required.
                               "top": 0,  # The distance
                                 from the top edge if the image to the top edge of the
                                 rectangle, in pixels. Required.
                               "width": 0  # The width of
                                 the rectangle, in pixels. Required.
                           },
                           "qualityForRecognition": "str"  #
                             Quality of face image for recognition. Required. Known values
                             are: "low", "medium", and "high".
                       }
                   }
               },
               "latencyInMilliseconds": 0,  # The server measured latency
                 for this request in milliseconds. Required.
               "statusCode": 0  # The HTTP status code returned to the
                 client. Required.
           },
           "sessionId": "str"  # The unique sessionId of the created session. It
             will expire 48 hours after it was created or may be deleted sooner using the
             corresponding session DELETE operation. Required.
       },
       "sessionStartDateTime": "2020-02-20 00:00:00"  # Optional. DateTime when this
         session was started by the client.
   }

get_liveness_with_verify_sessions

Lists sessions for /detectLivenessWithVerify/SingleModal.

List sessions from the last sessionId greater than the "start".

The result should be ordered by sessionId in ascending order.

get_liveness_with_verify_sessions(*, start: str | None = None, top: int | None = None, **kwargs: Any) -> List[LivenessSessionItem]

Keyword-Only Parameters

Name Description
start
str

List resources greater than the "start". It contains no more than 64 characters. Default is empty. Default value is None.

top
int

The number of items to list, ranging in [1, 1000]. Default is 1000. Default value is None.

Returns

Type Description

list of LivenessSessionItem

Exceptions

Type Description

Examples


   # response body for status code(s): 200
   response == [
       {
           "createdDateTime": "2020-02-20 00:00:00",  # DateTime when this
             session was created. Required.
           "id": "str",  # The unique ID to reference this session. Required.
           "sessionExpired": bool,  # Whether or not the session is expired.
             Required.
           "authTokenTimeToLiveInSeconds": 0,  # Optional. Seconds the session
             should last for. Range is 60 to 86400 seconds. Default value is 600.
           "deviceCorrelationId": "str",  # Optional. Unique Guid per each
             end-user device. This is to provide rate limiting and anti-hammering. If
             'deviceCorrelationIdSetInClient' is true in this request, this
             'deviceCorrelationId' must be null.
           "sessionStartDateTime": "2020-02-20 00:00:00"  # Optional. DateTime
             when this session was started by the client.
       }
   ]

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse

Parameters

Name Description
request
Required

The network request you want to make. Required.

Keyword-Only Parameters

Name Description
stream

Whether the response payload will be streamed. Defaults to False.

Returns

Type Description

The response of your network call. Does not do error handling on your response.