Returning plain text from whitelisted method

Continuing the discussion from POST parameters with dots:

Just want to share this small tip

This function:

import frappe

@frappe.whitelist(allow_guest=True)
def ping():
    return "pong"

Would return {"message":"pong"}

If you just want pong do this:

import frappe
from werkzeug.wrappers import Response


@frappe.whitelist(allow_guest=True)
def ping():
    return Response('pong')

Hope this will help someone else. It has been annoying me for a year now while trying to build a Facebook Bot with frappe as backend, which expects a text as response

6 Likes