Open master0v opened 3 years ago
I followed the advice given here: https://stackoverflow.com/questions/31866796/making-an-asynchronous-task-in-flask
Basically I had to change the Flask harness like so:
@app.route('/webhook', methods=['GET', 'POST'])
**async** def webhook():
if request.method == 'GET':
logger.debug(f"checking that {request.args.get('hub.verify_token')} == {configuration.cfg['FB_VERIFY_TOKEN']}")
if (request.args.get('hub.verify_token') == configuration.cfg['FB_VERIFY_TOKEN']):
return request.args.get('hub.challenge')
raise ValueError('FB_VERIFY_TOKEN does not match.')
elif request.method == 'POST':
**await** messenger.handle(request.get_json(force=True))
return ''
as well as install pip3 install asgiref
is this correct?
Would you like assistance or advice? assistance
Issue description in the example below, trying to call an async function from within "def message(self, message):"
Steps to reproduce insert "await inside the "def message(self, message):" where is a function defined as async
Traceback or other info