treethought / flask-assistant

Framework for Building Virtual Assistants with Dialogflow and python
Apache License 2.0
379 stars 101 forks source link

Fix KeyError on access_token #90

Closed gmolau closed 6 years ago

gmolau commented 6 years ago

The 'originalRequest' object contains data send from Actions on Google to Dialogflow. It is not present when the fulfillment is invoked via Dialogflows web UI directly, thus raising a KeyError. This adds an additional check for the presence of that object.

Note that according to the documentation the 'data' and 'user' objects can never raise KeyErrors as they are always present in the 'originalRequest' object (https://developers.google.com/actions/dialogflow/webhook).