我正在开发一个Alexa技能,使用Pylexa Python模块以美元比特币的价值回应,但每次我在亚马逊的在线技能测试人员上调用它时,我都会收到以下错误:
There was an error calling the remote endpoint, which returned HTTP 400 : BAD REQUEST
尝试使用本地计算机时出现此错误:
[400] Cert chain URL not valid.
可能是什么问题?代码部署在Heroku服务器上,如果有帮助的话。我的代码在下面,如果有帮助(我在其他技能中使用了相似的代码并且它有效):
import json
import os
import requests
from flask import Flask
from pylexa.app import alexa_blueprint
from pylexa.intent import handle_intent
from pylexa.app import handle_launch_request
from pylexa.response import PlainTextSpeech
app = Flask(__name__)
app.config['app_id'] = os.getenv('ALEXA_APP_ID')
app.register_blueprint(alexa_blueprint)
@handle_intent('GetBTC')
def handle_info_intent(request):
try:
print('Debug: ' + str(request.slots))
btcValue = requests.get('http://api.coindesk.com/v2/bpi/currentprice.json').json()['bpi']['USD']['rate']
print(btcValue)
return PlainTextSpeech("Currently, Bitcoin is worth " + btcValue + " dollars.")
except:
return PlainTextSpeech("I don't know.")
@handle_intent('A')
@handle_launch_request
def handle_start_message(request):
try:
print("New launch!")
btcValue = requests.get('http://api.coindesk.com/v2/bpi/currentprice.json').json()['bpi']['USD']['rate']
print(btcValue)
return PlainTextSpeech("Currently, Bitcoin is worth " + btcValue + " dollars.")
except:
return PlainTextSpeech("I don't know.")
if __name__ == '__main__':
app.run(debug=True)
意图架构:
{
"intents": [
{
"slots": [
{
"name": "BTC",
"type": "CURRENCY"
}
],
"intent": "GetBTC"
}
]
}
任何帮助都将不胜感激。