Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @respond_to('(.*)', re.IGNORECASE)
- def survey_reply(message, something):
- ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN, SUBSCRIPTION_KEY)
- request = ai.text_request()
- request.query = something
- response = request.getresponse()
- data = json.loads(response.read()) #convert string to dict
- user = message.body['user']
- print data.__class__
- print user
- if len(data['result']['fulfillment']['speech']) > 0:
- message.reply(data['result']['fulfillment']['speech'])
- else:
- message.reply(data['result']['metadata']['html'])
- print data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement