How to use the sanic.response.text function in sanic

To help you get started, we’ve selected a few sanic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github huge-success / sanic / tests / test_routes.py View on Github external
async def handler(request):
        return text("OK")
github huge-success / sanic / tests / test_request_stream.py View on Github external
async def post(request, id):
        assert isinstance(request.stream, StreamBuffer)
        result = ""
        while True:
            body = await request.stream.read()
            if body is None:
                break
            result += body.decode("utf-8")
        return text(result)
github vltr / sanic-boom / tests / test_boom_app.py View on Github external
async def handler(request):
        return text("OK")
github vltr / sanic-boom / tests / test_router.py View on Github external
async def foo_root_handler(request):
        return text("OK")  # noqa
github huge-success / sanic / tests / test_cookies.py View on Github external
def handler(request):
        response = text("pass")
        response.cookies["test"] = "pass"
        response.cookies["test"]["expires"] = expires
        return response
github RasaHQ / rasa / rasa / server.py View on Github external
    @app.get("/")
    async def hello(request: Request):
        """Check if the server is running and responds with the version."""
        return response.text("Hello from Rasa: " + rasa.__version__)
github zhao94254 / fun / pweb / concurrency / tsanic.py View on Github external
async def index(request):
    return text("hello world")
github huge-success / sanic / examples / run_asgi.py View on Github external
def handler_text(request):
    return response.text("Hello")
github ashleysommer / sanicpluginsframework / examples / contextualize_example.py View on Github external
def index2(request, args, context):
    shared = context.shared
    _ = shared.request
    return text("hello world")
github botfront / rasa-for-botfront / rasa / core / channels / rocketchat.py View on Github external
if output:
                if "visitor" not in output:
                    sender_name = output.get("user_name", None)
                    text = output.get("text", None)
                    recipient_id = output.get("channel_id", None)
                else:
                    messages_list = output.get("messages", None)
                    text = messages_list[0].get("msg", None)
                    sender_name = messages_list[0].get("username", None)
                    recipient_id = output.get("_id")

                await self.send_message(
                    text, sender_name, recipient_id, on_new_message, metadata
                )

            return response.text("")