azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py
def generate_thumbnail_in_stream(
            self, width, height, image, smart_cropping=False, custom_headers=None, raw=False, callback=None, **operation_config):
        """This operation generates a thumbnail image with the user-specified
        width and height. By default, the service analyzes the image,
        identifies the region of interest (ROI), and generates smart cropping
        coordinates based on the ROI. Smart cropping helps when you specify an
        aspect ratio that differs from that of the input image.
        A successful response contains the thumbnail image binary. If the
        request failed, the response contains an error code and a message to
        help determine what went wrong.
        Upon failure, the error code and an error message are returned. The
        error code could be one of InvalidImageUrl, InvalidImageFormat,
        InvalidImageSize, InvalidThumbnailSize, NotSupportedImage,
        FailedToProcess, Timeout, or InternalServerError.

        :param width: Width of the thumbnail, in pixels. It must be between 1
         and 1024. Recommended minimum of 50.
        :type width: int
        :param height: Height of the thumbnail, in pixels. It must be between
         1 and 1024. Recommended minimum of 50.
        :type height: int
        :param image: An image stream.
        :type image: Generator
        :param smart_cropping: Boolean flag for enabling smart cropping.
        :type smart_cropping: 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 callback: When specified, will be called with each chunk of
         data that is streamed. The callback should take two arguments, the
         bytes of the current chunk of data and the response object. If the
         data is uploading, response will be None.
        :type callback: Callable[Bytes, response=None]
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: object or ClientRawResponse if raw=true
        :rtype: Generator or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.generate_thumbnail_in_stream.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 = {}
        query_parameters['width'] = self._serialize.query("width", width, 'int', maximum=1024, minimum=1)
        query_parameters['height'] = self._serialize.query("height", height, 'int', maximum=1024, minimum=1)
        if smart_cropping is not None:
            query_parameters['smartCropping'] = self._serialize.query("smart_cropping", smart_cropping, 'bool')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/octet-stream'
        header_parameters['Content-Type'] = 'application/octet-stream'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._client.stream_upload(image, callback)

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

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

        deserialized = None

        if response.status_code == 200:
            deserialized = self._client.stream_download(response, callback)

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

        return deserialized
def generate_thumbnail_in_stream(
            self, width, height, image, smart_cropping=False, custom_headers=None, raw=False, callback=None, **operation_config):
        """This operation generates a thumbnail image with the user-specified
        width and height. By default, the service analyzes the image,
        identifies the region of interest (ROI), and generates smart cropping
        coordinates based on the ROI. Smart cropping helps when you specify an
        aspect ratio that differs from that of the input image.
        A successful response contains the thumbnail image binary. If the
        request failed, the response contains an error code and a message to
        help determine what went wrong.
        Upon failure, the error code and an error message are returned. The
        error code could be one of InvalidImageUrl, InvalidImageFormat,
        InvalidImageSize, InvalidThumbnailSize, NotSupportedImage,
        FailedToProcess, Timeout, or InternalServerError.

        :param width: Width of the thumbnail, in pixels. It must be between 1
         and 1024. Recommended minimum of 50.
        :type width: int
        :param height: Height of the thumbnail, in pixels. It must be between
         1 and 1024. Recommended minimum of 50.
        :type height: int
        :param image: An image stream.
        :type image: Generator
        :param smart_cropping: Boolean flag for enabling smart cropping.
        :type smart_cropping: 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 callback: When specified, will be called with each chunk of
         data that is streamed. The callback should take two arguments, the
         bytes of the current chunk of data and the response object. If the
         data is uploading, response will be None.
        :type callback: Callable[Bytes, response=None]
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: object or ClientRawResponse if raw=true
        :rtype: Generator or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        url = self.generate_thumbnail_in_stream.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 = {}
        query_parameters['width'] = self._serialize.query("width", width, 'int', maximum=1024, minimum=1)
        query_parameters['height'] = self._serialize.query("height", height, 'int', maximum=1024, minimum=1)
        if smart_cropping is not None:
            query_parameters['smartCropping'] = self._serialize.query("smart_cropping", smart_cropping, 'bool')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/octet-stream'
        header_parameters['Content-Type'] = 'application/octet-stream'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._client.stream_upload(image, callback)

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

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

        deserialized = None

        if response.status_code == 200:
            deserialized = self._client.stream_download(response, callback)

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

        return deserialized
def generate_thumbnail_in_stream ( self , width , height , image , smart_cropping = False , custom_headers = None , raw = False , callback = None , * * operation_config ) : # Construct URL url = self . generate_thumbnail_in_stream . 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 = { } query_parameters [ 'width' ] = self . _serialize . query ( "width" , width , 'int' , maximum = 1024 , minimum = 1 ) query_parameters [ 'height' ] = self . _serialize . query ( "height" , height , 'int' , maximum = 1024 , minimum = 1 ) if smart_cropping is not None : query_parameters [ 'smartCropping' ] = self . _serialize . query ( "smart_cropping" , smart_cropping , 'bool' ) # Construct headers header_parameters = { } header_parameters [ 'Accept' ] = 'application/octet-stream' header_parameters [ 'Content-Type' ] = 'application/octet-stream' if custom_headers : header_parameters . update ( custom_headers ) # Construct body body_content = self . _client . stream_upload ( image , callback ) # Construct and send request request = self . _client . post ( url , query_parameters , header_parameters , body_content ) response = self . _client . send ( request , stream = True , * * operation_config ) if response . status_code not in [ 200 ] : raise HttpOperationError ( self . _deserialize , response ) deserialized = None if response . status_code == 200 : deserialized = self . _client . stream_download ( response , callback ) if raw : client_raw_response = ClientRawResponse ( deserialized , response ) return client_raw_response return deserialized
This operation generates a thumbnail image with the user-specified
        width and height. By default, the service analyzes the image,
        identifies the region of interest (ROI), and generates smart cropping
        coordinates based on the ROI. Smart cropping helps when you specify an
        aspect ratio that differs from that of the input image.
        A successful response contains the thumbnail image binary. If the
        request failed, the response contains an error code and a message to
        help determine what went wrong.
        Upon failure, the error code and an error message are returned. The
        error code could be one of InvalidImageUrl, InvalidImageFormat,
        InvalidImageSize, InvalidThumbnailSize, NotSupportedImage,
        FailedToProcess, Timeout, or InternalServerError.

        :param width: Width of the thumbnail, in pixels. It must be between 1
         and 1024. Recommended minimum of 50.
        :type width: int
        :param height: Height of the thumbnail, in pixels. It must be between
         1 and 1024. Recommended minimum of 50.
        :type height: int
        :param image: An image stream.
        :type image: Generator
        :param smart_cropping: Boolean flag for enabling smart cropping.
        :type smart_cropping: 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 callback: When specified, will be called with each chunk of
         data that is streamed. The callback should take two arguments, the
         bytes of the current chunk of data and the response object. If the
         data is uploading, response will be None.
        :type callback: Callable[Bytes, response=None]
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: object or ClientRawResponse if raw=true
        :rtype: Generator or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
This operation generates a thumbnail image with the user - specified width and height . By default the service analyzes the image identifies the region of interest ( ROI ) and generates smart cropping coordinates based on the ROI . Smart cropping helps when you specify an aspect ratio that differs from that of the input image . A successful response contains the thumbnail image binary . If the request failed the response contains an error code and a message to help determine what went wrong . Upon failure the error code and an error message are returned . The error code could be one of InvalidImageUrl InvalidImageFormat InvalidImageSize InvalidThumbnailSize NotSupportedImage FailedToProcess Timeout or InternalServerError .