Exemple #1
0
    def on_get(self, req, resp, address):
        """
        Handles retrieval of an existing Host.

        :param req: Request instance that will be passed through.
        :type req: falcon.Request
        :param resp: Response instance that will be passed through.
        :type resp: falcon.Response
        :param address: The address of the Host being requested.
        :type address: str
        """
        # TODO: Verify input
        try:
            host = Host.retrieve(address)
            resp.status = falcon.HTTP_200
            req.context["model"] = host
        except:
            resp.status = falcon.HTTP_404
            return