Привет мир на колбу-спросите библиотеку - Алекса Skill + Raspberry Pi 1 - PullRequest
0 голосов
/ 28 октября 2019

У меня проблема. Я надеюсь, что кто-то может мне помочь.

У меня есть этот код, созданный с помощью библиотеки колб-спросите:

from flask import Flask, render_template
from flask_ask import Ask, statement, question

app = Flask(__name__)
ask = Ask(app, '/')

@ask.launch
def launch():
    welcome_text = render_template('welcome_text')
    return question(welcome_text)

@ask.intent('AMAZON.FallbackIntent')
def fallback():
    reprompt_text = render_template('ask_name_reprompt')
    return question(reprompt_text)

@ask.intent('HelloWorldIntent')
def hello(firstname):
    if firstname is None:
        #no name was given
        ask_name_text = render_template('ask_name')
        return question(ask_name_text)
    response_text = render_template('hello', firstname=firstname)
    return statement(response_text).simple_card('Hello', response_text)

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

И я создаю простой пользовательский навык alexa. Я использую ngrok для публикации этого кода на Raspberry Pi 1, и сгенерированная публичная ссылка вставляется в URL-адрес конечной точки Alexa Skill.

Когда я запускаю навык, он подключается к моему raspberry pi, и на него приходит запрос, но я получаю сообщения об ошибках на терминале:

    File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/usr/local/lib/python3.7/dist-packages/flask/_compat.py", line 33, in reraise

    raise value

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/usr/local/lib/python3.7/dist-packages/flask/_compat.py", line 33, in reraise

    raise value

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/usr/local/lib/python3.7/dist-packages/flask_ask/core.py", line 728, in _flask_view_func

    ask_payload = self._alexa_request(verify=self.ask_verify_requests)

  File "/usr/local/lib/python3.7/dist-packages/flask_ask/core.py", line 662, in _alexa_request

    cert = verifier.load_certificate(cert_url)

  File "/usr/local/lib/python3.7/dist-packages/flask_ask/verifier.py", line 21, in load_certificate

    if not _valid_certificate(cert):

  File "/usr/local/lib/python3.7/dist-packages/flask_ask/verifier.py", line 63, in _valid_certificate

    value = str(extension)

  File "/usr/local/lib/python3.7/dist-packages/OpenSSL/crypto.py", line 779, in __str__

    return self._subjectAltNameString()

  File "/usr/local/lib/python3.7/dist-packages/OpenSSL/crypto.py", line 740, in _subjectAltNameString

    method = _lib.X509V3_EXT_get(self._extension)

AttributeError: module 'lib' has no attribute 'X509V3_EXT_get'

127.0.0.1 - - [27/Oct/2019 14:35:02] "POST / HTTP/1.1" 500 -

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/usr/local/lib/python3.7/dist-packages/flask/_compat.py", line 33, in reraise

    raise value

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/usr/local/lib/python3.7/dist-packages/flask/_compat.py", line 33, in reraise

    raise value

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/usr/local/lib/python3.7/dist-packages/flask_ask/core.py", line 728, in _flask_view_func

    ask_payload = self._alexa_request(verify=self.ask_verify_requests)

  File "/usr/local/lib/python3.7/dist-packages/flask_ask/core.py", line 662, in _alexa_request

    cert = verifier.load_certificate(cert_url)

  File "/usr/local/lib/python3.7/dist-packages/flask_ask/verifier.py", line 21, in load_certificate

    if not _valid_certificate(cert):

  File "/usr/local/lib/python3.7/dist-packages/flask_ask/verifier.py", line 63, in _valid_certificate

    value = str(extension)

  File "/usr/local/lib/python3.7/dist-packages/OpenSSL/crypto.py", line 779, in __str__

    return self._subjectAltNameString()

  File "/usr/local/lib/python3.7/dist-packages/OpenSSL/crypto.py", line 740, in _subjectAltNameString

    method = _lib.X509V3_EXT_get(self._extension)

AttributeError: module 'lib' has no attribute 'X509V3_EXT_get'

Это сообщение от ngrok:

POST/      500 INTERNAL SERVER ERROR

Что это значит? На Raspberry Pi 3 B + это работает.

Большое спасибо

...