def text_response ( self , contents , code = 200 , headers = { } ) : return Response ( contents , status = code , headers = { 'Content-Type' : 'text/plain' } )
content type flask python
shortcut to return simple plain / text messages in the response .
def text_response(self, contents, code=200, headers={}):
        """shortcut to return simple plain/text messages in the response.

        :param contents: a string with the response contents
        :param code: the http status code
        :param headers: a dict with optional headers
        :returns: a :py:class:`flask.Response` with the ``text/plain`` **Content-Type** header.
        """
        return Response(contents, status=code, headers={
            'Content-Type': 'text/plain'
        })