def put(self, hostname):
        """**Update a Host**

        **Example Request:**

        .. sourcecode:: http

            PUT /api/v1/hosts/example HTTP/1.1
            Host: localhost
            Content-Type: application/json

            {
                "hostname": "newname",
            }

        **Example response:**

        .. sourcecode:: http

            HTTP/1.1 200 OK
            Content-Type: application/json

            {
                "status": "ok",
                "id": 1,
                "href": "/api/v1/hosts/example",
                "hostname": "newname",
            }

        :param hostname: hostname of the Host that should be updated.
        :type hostname: string

        :reqjson string hostname: The new hostname of the Host.

        :reqheader Content-Type: The server expects a json body specified with
                                 this header.

        :statuscode 200: The request was successful.
        :statuscode 400: The request was malformed.
        :statuscode 401: The request was made without being logged in.
        :statuscode 403: The request was made with insufficient permissions.
        :statuscode 404: The Host at hostname was not found.
        :statuscode 409: There was a conflict with another resource.
        """
        log.info("HOS: Update {}".format(hostname))

        host = self.session.query(Host).filter_by(hostname=hostname).scalar()
        if not host:
            raise exc.NotFound("No such Host {} found".format(hostname))

        try:
            new_hostname = self.jbody["hostname"]
        except __HOLE__ as err:
            raise exc.BadRequest(
                "Missing Required Argument: {}".format(err.message)
            )

        host = host.update_name(new_hostname);

        json = host.to_dict(self.href_prefix)

        self.success(json)

        log.info("HOST: Renamed {} to {}".format(hostname, new_hostname))
dataset/ETHPy150Open dropbox/hermes/hermes/handlers/api.py/HostHandler.put