沃森语音转文本register_callback仅返回400s [英] Watson Speech-to-Text register_callback returns only 400s

查看:94
本文介绍了沃森语音转文本register_callback仅返回400s的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Watson语音- to-Text异步HTTP接口允许通过调用register_callback来注册回调URL.这个电话显然是行不通的.为了进行说明,请参见以下六行代码.

The Watson Speech-to-Text asynchronous HTTP interface allows one to register a callback url through a call to register_callback. This call is clearly not working; for illustration, please see these six lines of code.

# Illustration of how I can't get the Watson Speech-to-Text
# register_callback call to work.

r = requests.post(
    "https://stream.watsonplatform.net/speech-to-text/api/v1/register_callback?{0}".format(
        urllib.urlencode({ "callback_url": callback_url })),
    auth=(watson_username, watson_password),
    data="{}")

print(r.status_code)
print(pprint.pformat(r.json()))

# This outputs:

# 400
# {u'code': 400,
#  u'code_description': u'Bad Request',
#  u'error': u"unable to verify callback url 'https://xuyv2beqpj.execute-api.us-east-1.amazonaws.com/prod/SpeechToTextCallback' , server responded with status code: 400"}

# and no http call is logged on the server.

r = requests.get(
    callback_url, params=dict(challenge_string="what does redacted mean?"))

print(r.status_code)
print(r.text)

# This outputs:

# 200
# what does redacted mean?

# and an HTTP GET is logged on the server.

我首先使用完全有效的callback_url参数调用register_callback,这与文档描述的完全相同.该调用返回400,根据我的回调URL服务器日志,该回调URL从未收到HTTP请求.然后,我自己用challenge_string GET回调URL.回调URL不仅会以正确的输出进行响应,而且还会在我的服务器上显示一条日志,指示URL收到了HTTP请求.我得出的结论是register_call无法正常工作.

I first call register_callback with a perfectly valid callback_url parameter, in exactly the way the documentation describes. This call returns with a 400 and, according to my callback URL server logs, the callback URL never receives an HTTP request. Then I GET the callback URL myself with a challenge_string. Not only is the callback URL responding with the right output, but a log appears on my server indicating the URL received an HTTP request. I conclude that register_call is not working.

推荐答案

答案:

我们最终确定了问题:对您的URL进行出站呼叫的服务器不支持回调服务器使用的SSL加密方法.我们已经解决了这个问题,并且很快将其推向生产环境.

We identified the issue on our end: the server that makes the outbound calls to your URL did not support the SSL encryption method that your callback server uses. We have fixed that and we are in the process of pushing to the production environment very soon.

也供您参考:

错误消息400表示回调URL不符合 请求或不存在.请参阅中的详细信息 语音转文字服务API文档, http://www.ibm.com/watson/developercloud/speech-to-text/api/v1/?curl#register_callback

The error message with 400 indicates the callback URL does not meet request or does not exist. Please refer to the detail in Speech-To-Text service API document, http://www.ibm.com/watson/developercloud/speech-to-text/api/v1/?curl#register_callback

如果该服务未收到响应代码为200的响应 和一个主体,从主体中回显随机的字母数字质询字符串 在5秒钟内回调URL,但不会将该URL列入白名单;它 发送响应代码400以响应注册请求.

If the service does not receive a response with a response code of 200 and a body that echoes a random alphanumeric challenge string from the callback URL within 5 seconds, it does not whitelist the URL; it sends response code 400 in response to the registration request.

这篇关于沃森语音转文本register_callback仅返回400s的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆