def post()

in example_app/graviton2_gh_runner_flask_app/resources/books.py [0:0]


    def post(self):
        """Add a new book."""
        body = request.get_json()

        if body:
            b = Book(**body)

            try:
                self.books_controller.put_new_book(item=b.record)
            except ClientError as e:
                resp = {"error": str(e)}, 404
            else:
                resp = {"data": b.book_id}, 201
        else:
            resp = {"error": "missing body"}, 404

        return resp