def post(self):
        """**Create a Fate entry**

        **Example Request:**

        .. sourcecode:: http

            POST /api/v1/fates HTTP/1.1
            Host: localhost
            Content-Type: application/json
            {
                "creationEventTypeId": 1,
                "description": "This is a fate",
                "followsId": 1,
                "forCreator": true,
            }

        **Example response:**

        .. sourcecode:: http

            HTTP/1.1 201 OK
            Location: /api/v1/fates/1

            {
                "status": "created",
                "href": "/api/v1/fates/3",
                "id": 3,
                "creationEventTypeId": 1,
                "followsId": 1,
                "precedesIds": [],
                "forCreator": true,
                "description": "This is a fate"
            }

        :reqjson int creationEventTypeId: the ID of the EventType that triggers this Fate
        :regjson int follows: (*optional*) The ID of the Fate this Fate must come after, or null
        :regjson string description: (*optional*) The human readable description this Fate
        :regjson boolean forOwner: (*optional*) Indicates that Labors created by this Fate
                                    would be designated for action by the server owner.
                                    Default: true
        :regjson boolean forCreator: (*optional*) Indicates that Labors created by this Fate
                                    would be designated for action by the Quest owner.
                                    Default: false

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

        :resheader Location: URL to the created resource.

        :statuscode 201: The Fate was successfully created.
        :statuscode 400: The request was malformed.
        :statuscode 401: The request was made without being logged in.
        :statuscode 409: There was a conflict with another resource.
        """

        try:
            creation_event_type_id = self.jbody["creationEventTypeId"]
            follows_id = self.jbody.get("followsId")
            for_creator = self.jbody.get("forCreator", False)
            for_owner = self.jbody.get("forOwner", True)
            description = self.jbody["description"]
        except KeyError as err:
            raise exc.BadRequest(
                "Missing Required Argument: {}".format(err.message)
            )
        except __HOLE__ as err:
            raise exc.BadRequest(err.message)

        log.info(
            "FATE: Create fate (event-type {}, follows {}, for creator {}, "
            "for owner {}, desc {})".format(
                creation_event_type_id, follows_id,
                for_creator, for_owner, description
            )
        )

        creation_event_type = (
            self.session.query(EventType).get(creation_event_type_id)
        )

        if creation_event_type is None:
            self.write_error(400, message="Bad creation event type")
            return

        try:
            fate = Fate.create(
                self.session, creation_event_type,
                follows_id=follows_id, for_creator=for_creator,
                for_owner=for_owner,
                description=description
            )
        except IntegrityError as err:
            raise exc.Conflict(err.orig.message)
        except exc.ValidationError as err:
            raise exc.BadRequest(err.message)

        self.session.commit()

        json = fate.to_dict(self.href_prefix)
        json["href"] = "/api/v1/fates/{}".format(fate.id)

        self.created("/api/v1/fates/{}".format(fate.id), json)

        log.info(
            "FATE: Created fate {} (event-type {}, follows {}, "
            "for creator {}, for owner {}, desc {})".format(
                fate.id,
                creation_event_type_id, follows_id,
                for_creator, for_owner, description
            )
        )
dataset/ETHPy150Open dropbox/hermes/hermes/handlers/api.py/FatesHandler.post