POST parameters with dots

I am using this function to accept post request

def verify(, user.domain,_type='POST'):

The request comes from another service and sends 2 params, and user.domain. Notice the dots in parameter names, and I don’t have control to change them. Any idea how this can be done, as python is not accepting the dotted variable names?

Also related, can I use annotation like in flask to use a custom path instead of the default function name ?

Syntax issue,

Yes, that is the error I am getting. Maybe to be specific, I am trying to use ERPNext as a facebook messenger bot, i.e users interact with ERPNext using Facebook messenger. The bot protocol expects you to implement a POST method accepting hub.mode, hub.verify_token and hub.challenge parameters and my function would look like

def verify(hub.mode, hub.verify_token, hub.challenge):

Finding no better way, I have used a Flask server that interacts with FB and calls ERPNext in the backend, which works but would have preferred an ERPNext only design.


having protocol you can use, trick:

def verify(**kwargs):
    assert 'hub.mode' in kwargs
    assert 'hub.verify_token' in kwargs
    assert 'hub.challenge' in kwargs
   print kwargs['hub.mode']
1 Like

Thanks, let me try that

Another small issue. If I do return “Hello world”, Frappe returns {“message”: “Hello World” }. Is there a way around this. I would like to get just “Hello world”