azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_operations.py
def detect_with_url(
            self, url, return_face_id=True, return_face_landmarks=False, return_face_attributes=None, recognition_model="recognition_01", return_recognition_model=False, custom_headers=None, raw=False, **operation_config):
        """Detect human faces in an image, return face rectangles, and optionally
        with faceIds, landmarks, and attributes.<br />
        * Optional parameters including faceId, landmarks, and attributes.
        Attributes include age, gender, headPose, smile, facialHair, glasses,
        emotion, hair, makeup, occlusion, accessories, blur, exposure and
        noise.
        * The extracted face feature, instead of the actual image, will be
        stored on server. The faceId is an identifier of the face feature and
        will be used in [Face -
        Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239),
        [Face -
        Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a),
        and [Face - Find
        Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
        It will expire 24 hours after the detection call.
        * Higher face image quality means better detection and recognition
        precision. Please consider high-quality faces: frontal, clear, and face
        size is 200x200 pixels (100 pixels between eyes) or bigger.
        * JPEG, PNG, GIF (the first frame), and BMP format are supported. The
        allowed image file size is from 1KB to 6MB.
        * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If
        need to detect very small but clear faces, please try to enlarge the
        input image.
        * Up to 64 faces can be returned for an image. Faces are ranked by face
        rectangle size from large to small.
        * Face detector prefer frontal and near-frontal faces. There are cases
        that faces may not be detected, e.g. exceptionally large face angles
        (head-pose) or being occluded, or wrong image orientation.
        * Attributes (age, gender, headPose, smile, facialHair, glasses,
        emotion, hair, makeup, occlusion, accessories, blur, exposure and
        noise) may not be perfectly accurate. HeadPose's pitch value is a
        reserved field and will always return 0.
        * Different 'recognitionModel' values are provided. If follow-up
        operations like Verify, Identify, Find Similar are needed, please
        specify the recognition model with 'recognitionModel' parameter. The
        default value for 'recognitionModel' is 'recognition_01', if latest
        model needed, please explicitly specify the model you need in this
        parameter. Once specified, the detected faceIds will be associated with
        the specified recognition model. More details, please refer to [How to
        specify a recognition
        model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model)
        .

        :param url: Publicly reachable URL of an image
        :type url: str
        :param return_face_id: A value indicating whether the operation should
         return faceIds of detected faces.
        :type return_face_id: bool
        :param return_face_landmarks: A value indicating whether the operation
         should return landmarks of the detected faces.
        :type return_face_landmarks: bool
        :param return_face_attributes: Analyze and return the one or more
         specified face attributes in the comma-separated string like
         "returnFaceAttributes=age,gender". Supported face attributes include
         age, gender, headPose, smile, facialHair, glasses and emotion. Note
         that each face attribute analysis has additional computational and
         time cost.
        :type return_face_attributes: list[str or
         ~azure.cognitiveservices.vision.face.models.FaceAttributeType]
        :param recognition_model: Name of recognition model. Recognition model
         is used when the face features are extracted and associated with
         detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition
         model name can be provided when performing Face - Detect or
         (Large)FaceList - Create or (Large)PersonGroup - Create. The default
         value is 'recognition_01', if latest model needed, please explicitly
         specify the model you need. Possible values include: 'recognition_01',
         'recognition_02'
        :type recognition_model: str or
         ~azure.cognitiveservices.vision.face.models.RecognitionModel
        :param return_recognition_model: A value indicating whether the
         operation should return 'recognitionModel' in response.
        :type return_recognition_model: bool
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~azure.cognitiveservices.vision.face.models.DetectedFace]
         or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`
        """
        image_url = models.ImageUrl(url=url)

        # Construct URL
        url = self.detect_with_url.metadata['url']
        path_format_arguments = {
            'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        if return_face_id is not None:
            query_parameters['returnFaceId'] = self._serialize.query("return_face_id", return_face_id, 'bool')
        if return_face_landmarks is not None:
            query_parameters['returnFaceLandmarks'] = self._serialize.query("return_face_landmarks", return_face_landmarks, 'bool')
        if return_face_attributes is not None:
            query_parameters['returnFaceAttributes'] = self._serialize.query("return_face_attributes", return_face_attributes, '[FaceAttributeType]', div=',')
        if recognition_model is not None:
            query_parameters['recognitionModel'] = self._serialize.query("recognition_model", recognition_model, 'str')
        if return_recognition_model is not None:
            query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(image_url, 'ImageUrl')

        # Construct and send request
        request = self._client.post(url, query_parameters, header_parameters, body_content)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.APIErrorException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('[DetectedFace]', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
def detect_with_url(
            self, url, return_face_id=True, return_face_landmarks=False, return_face_attributes=None, recognition_model="recognition_01", return_recognition_model=False, custom_headers=None, raw=False, **operation_config):
        """Detect human faces in an image, return face rectangles, and optionally
        with faceIds, landmarks, and attributes.<br />
        * Optional parameters including faceId, landmarks, and attributes.
        Attributes include age, gender, headPose, smile, facialHair, glasses,
        emotion, hair, makeup, occlusion, accessories, blur, exposure and
        noise.
        * The extracted face feature, instead of the actual image, will be
        stored on server. The faceId is an identifier of the face feature and
        will be used in [Face -
        Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239),
        [Face -
        Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a),
        and [Face - Find
        Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
        It will expire 24 hours after the detection call.
        * Higher face image quality means better detection and recognition
        precision. Please consider high-quality faces: frontal, clear, and face
        size is 200x200 pixels (100 pixels between eyes) or bigger.
        * JPEG, PNG, GIF (the first frame), and BMP format are supported. The
        allowed image file size is from 1KB to 6MB.
        * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If
        need to detect very small but clear faces, please try to enlarge the
        input image.
        * Up to 64 faces can be returned for an image. Faces are ranked by face
        rectangle size from large to small.
        * Face detector prefer frontal and near-frontal faces. There are cases
        that faces may not be detected, e.g. exceptionally large face angles
        (head-pose) or being occluded, or wrong image orientation.
        * Attributes (age, gender, headPose, smile, facialHair, glasses,
        emotion, hair, makeup, occlusion, accessories, blur, exposure and
        noise) may not be perfectly accurate. HeadPose's pitch value is a
        reserved field and will always return 0.
        * Different 'recognitionModel' values are provided. If follow-up
        operations like Verify, Identify, Find Similar are needed, please
        specify the recognition model with 'recognitionModel' parameter. The
        default value for 'recognitionModel' is 'recognition_01', if latest
        model needed, please explicitly specify the model you need in this
        parameter. Once specified, the detected faceIds will be associated with
        the specified recognition model. More details, please refer to [How to
        specify a recognition
        model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model)
        .

        :param url: Publicly reachable URL of an image
        :type url: str
        :param return_face_id: A value indicating whether the operation should
         return faceIds of detected faces.
        :type return_face_id: bool
        :param return_face_landmarks: A value indicating whether the operation
         should return landmarks of the detected faces.
        :type return_face_landmarks: bool
        :param return_face_attributes: Analyze and return the one or more
         specified face attributes in the comma-separated string like
         "returnFaceAttributes=age,gender". Supported face attributes include
         age, gender, headPose, smile, facialHair, glasses and emotion. Note
         that each face attribute analysis has additional computational and
         time cost.
        :type return_face_attributes: list[str or
         ~azure.cognitiveservices.vision.face.models.FaceAttributeType]
        :param recognition_model: Name of recognition model. Recognition model
         is used when the face features are extracted and associated with
         detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition
         model name can be provided when performing Face - Detect or
         (Large)FaceList - Create or (Large)PersonGroup - Create. The default
         value is 'recognition_01', if latest model needed, please explicitly
         specify the model you need. Possible values include: 'recognition_01',
         'recognition_02'
        :type recognition_model: str or
         ~azure.cognitiveservices.vision.face.models.RecognitionModel
        :param return_recognition_model: A value indicating whether the
         operation should return 'recognitionModel' in response.
        :type return_recognition_model: bool
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~azure.cognitiveservices.vision.face.models.DetectedFace]
         or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`
        """
        image_url = models.ImageUrl(url=url)

        # Construct URL
        url = self.detect_with_url.metadata['url']
        path_format_arguments = {
            'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        if return_face_id is not None:
            query_parameters['returnFaceId'] = self._serialize.query("return_face_id", return_face_id, 'bool')
        if return_face_landmarks is not None:
            query_parameters['returnFaceLandmarks'] = self._serialize.query("return_face_landmarks", return_face_landmarks, 'bool')
        if return_face_attributes is not None:
            query_parameters['returnFaceAttributes'] = self._serialize.query("return_face_attributes", return_face_attributes, '[FaceAttributeType]', div=',')
        if recognition_model is not None:
            query_parameters['recognitionModel'] = self._serialize.query("recognition_model", recognition_model, 'str')
        if return_recognition_model is not None:
            query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(image_url, 'ImageUrl')

        # Construct and send request
        request = self._client.post(url, query_parameters, header_parameters, body_content)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.APIErrorException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('[DetectedFace]', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
Detect human faces in an image, return face rectangles, and optionally
        with faceIds, landmarks, and attributes.<br />
        * Optional parameters including faceId, landmarks, and attributes.
        Attributes include age, gender, headPose, smile, facialHair, glasses,
        emotion, hair, makeup, occlusion, accessories, blur, exposure and
        noise.
        * The extracted face feature, instead of the actual image, will be
        stored on server. The faceId is an identifier of the face feature and
        will be used in [Face -
        Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239),
        [Face -
        Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a),
        and [Face - Find
        Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
        It will expire 24 hours after the detection call.
        * Higher face image quality means better detection and recognition
        precision. Please consider high-quality faces: frontal, clear, and face
        size is 200x200 pixels (100 pixels between eyes) or bigger.
        * JPEG, PNG, GIF (the first frame), and BMP format are supported. The
        allowed image file size is from 1KB to 6MB.
        * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If
        need to detect very small but clear faces, please try to enlarge the
        input image.
        * Up to 64 faces can be returned for an image. Faces are ranked by face
        rectangle size from large to small.
        * Face detector prefer frontal and near-frontal faces. There are cases
        that faces may not be detected, e.g. exceptionally large face angles
        (head-pose) or being occluded, or wrong image orientation.
        * Attributes (age, gender, headPose, smile, facialHair, glasses,
        emotion, hair, makeup, occlusion, accessories, blur, exposure and
        noise) may not be perfectly accurate. HeadPose's pitch value is a
        reserved field and will always return 0.
        * Different 'recognitionModel' values are provided. If follow-up
        operations like Verify, Identify, Find Similar are needed, please
        specify the recognition model with 'recognitionModel' parameter. The
        default value for 'recognitionModel' is 'recognition_01', if latest
        model needed, please explicitly specify the model you need in this
        parameter. Once specified, the detected faceIds will be associated with
        the specified recognition model. More details, please refer to [How to
        specify a recognition
        model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model)
        .

        :param url: Publicly reachable URL of an image
        :type url: str
        :param return_face_id: A value indicating whether the operation should
         return faceIds of detected faces.
        :type return_face_id: bool
        :param return_face_landmarks: A value indicating whether the operation
         should return landmarks of the detected faces.
        :type return_face_landmarks: bool
        :param return_face_attributes: Analyze and return the one or more
         specified face attributes in the comma-separated string like
         "returnFaceAttributes=age,gender". Supported face attributes include
         age, gender, headPose, smile, facialHair, glasses and emotion. Note
         that each face attribute analysis has additional computational and
         time cost.
        :type return_face_attributes: list[str or
         ~azure.cognitiveservices.vision.face.models.FaceAttributeType]
        :param recognition_model: Name of recognition model. Recognition model
         is used when the face features are extracted and associated with
         detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition
         model name can be provided when performing Face - Detect or
         (Large)FaceList - Create or (Large)PersonGroup - Create. The default
         value is 'recognition_01', if latest model needed, please explicitly
         specify the model you need. Possible values include: 'recognition_01',
         'recognition_02'
        :type recognition_model: str or
         ~azure.cognitiveservices.vision.face.models.RecognitionModel
        :param return_recognition_model: A value indicating whether the
         operation should return 'recognitionModel' in response.
        :type return_recognition_model: bool
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~azure.cognitiveservices.vision.face.models.DetectedFace]
         or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`