def post(self):
        """Handles the post request with the sudoku image to solve.
        Accepts binary (as from <input type="file">) as default, and looks for an image
        file at a specified URL if the binary input is not given.
        Launches a task queue task, run on a VM backend, to solve the given puzzle.
        Returns a JSON message to the client, which includes a URL that will contain
        the result.
        """

        # generate a URL to which the result will be written
        filename = utils.create_fname('jpg')  # A new GCS-formatted filename.
        # based on the filename, the results will show up at this URL.
        solved_url = self.api_url % filename
        image_data = self.request.get('sudoku')
        image_url = ''
        # if we got image data, write it to a GCS file and generate a URL
        if image_data:
            image_data = decode_if_needed(image_data)
            gcs_file = utils.create_png_file(image_data)
            image_url = self.api_url + gcs_file
        else:
            # otherwise, try to get the image from the default URL in the form
            logging.info("did not get image data from form submit")
            image_url = self.request.get('sudoku_url')
        if not image_url:
            logging.warn("could not generate image url")
            resp = self.generate_error_response(filename, solved_url)
            self.response.headers['Content-Type'] = 'application/json'
            self.response.write(resp)
            return
        logging.info("using image url: %s", image_url)
        # create a task to solve the puzzle.  The handler will be routed to a
        # Managed VM.
        try:
            # Create a Task Queue task to parse and solve the puzzle.
            # As task parameters, indicate the URL containing the image to solve, and
            # the GCS filename to which to write the solution image.
            task = taskqueue.Task(url='/solve_async',
                           method='POST',
                           params={'image_url': image_url,
                                   'filename' : filename})
            # add the task to the default task queue. (Alternately, you could define a separate
            # dedicated task queue for this purpose).
            taskqueue.Queue().add(task)
            # Respond to the client, indicating the URL to which the solution will
            # be written.
            resp = {'status': 'OK',
                    'solved_url' : solved_url}
            self.response.headers['Content-Type'] = 'application/json'
            self.response.write(json.dumps(resp))

        except (taskqueue.UnknownQueueError, taskqueue.TransientError):
            logging.exception("issue adding task to queue")
            resp = self.generate_error_response(filename, solved_url)
            self.response.headers['Content-Type'] = 'application/json'
            self.response.write(resp)
dataset/ETHPy150Open GoogleCloudPlatform/appengine-opencv-sudoku-python/main.py/SolveStage.post/operator `+` -> `%`