【问题标题】:ask_sdk_runtime.exceptions.DispatchException: Unable to find a suitable request handlerask_sdk_runtime.exceptions.DispatchException:找不到合适的请求处理程序
【发布时间】:2021-01-20 07:10:00
【问题描述】:

我正在使用 alexa 开发我的第一个技能并且我正在使用插槽,但是在插槽响应方面我遇到了一个小问题。我有错误 ask_sdk_runtime.exceptions.DispatchException: Unable to find a suitable request handler 我该如何解决?

【问题讨论】:

    标签: python python-3.x alexa-skills-kit alexa-slot


    【解决方案1】:

    我建议添加RequestInterceptor 来记录所有传入请求。通过这种方式,您可以找出导致问题的请求类型。

    示例代码:

    class LogRequestInterceptor(AbstractRequestInterceptor):
        def process(self, handler_input):
            logger.info(f"Request type: {handler_input.request_envelope.request.object_type}")
    
    

    然后像其他处理程序一样将其添加到您的技能构建器中: sb.add_global_request_interceptor(LogRequestInterceptor())

    Python AbstractRequestInterceptor 文档:https://alexa-skills-kit-python-sdk.readthedocs.io/en/latest/api/core.html?highlight=requestinterceptor#ask_sdk_core.dispatch_components.request_components.AbstractRequestInterceptor

    【讨论】:

      猜你喜欢
      • 2016-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-09
      • 2021-01-06
      • 1970-01-01
      • 2014-02-28
      相关资源
      最近更新 更多