dialogflow-python-client icon indicating copy to clipboard operation
dialogflow-python-client copied to clipboard

Couldn't return the response

Open amaboura opened this issue 9 years ago • 2 comments
trafficstars

Hi there,

There is a weird response behavior that i could't understand, when i try to send a query that matches one of my custom intents, i get the following error

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: YeniHRaduRn5dVzhK3L0cLTc2tMeqLaoPNhby3N9Zk6j-PQkOF8lPg==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: JAJeScxuDj-X97YHn_piTfMWNak8XxVvI7EScppuwUgJO4IkwwMo8Q==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>

Note that:

  • I get the json response if the query is assigned to one of the predefined domains (eg: Smalltalk)
  • I'm sending the request from within an HTTP method

Any ideas ?

amaboura avatar Oct 25 '16 09:10 amaboura

Hi @amaboura, Please send me example of your code for reproduce an issue and maybe you account email, I'll check your agent...

sstepashka avatar Oct 25 '16 16:10 sstepashka

Here's the snippet that i have tried

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from flask import Flask, request
import os.path
import sys
try:
    import apiai
except ImportError:
    sys.path.append(
        os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)
    )
    import apiai

app = Flask(__name__)

CLIENT_ACCESS_TOKEN = "d8996d6ab4c541f29dc0fcb869c868bf"

def handle_query(query):
    ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN)
    request = ai.text_request()
    request.lang = 'en'
    request.query = query
    response = request.getresponse()
    print (response.read())

#if __name__ == '__main__':
 #   handle_query("say my name")

# query example : find <something>
@app.route("/echo")
def hello():
    query = request.args.get("q")
    handle_query(query)
    return "Echo back"


if __name__ == "__main__":
    app.run(debug=True)

@sstepashka FYI

I've got few intents for my agent, here are the steps to reproduce the issue:

  • type say my name , should get you a JSON response
  • type say my name out loud, should get you also a JSON response
  • type find nexus, should get you the error i referred to above

Note that the above queries work fine in the API console.

here is a screen capture from my terminal : https://asciinema.org/a/2ab0imh7lbfmf35nbaezwmfic

amaboura avatar Oct 26 '16 07:10 amaboura