2017-07-18 82 views
0

我正在使用Python模塊以Pylexa Python模塊響應比特幣價值的Alexa技能,但每次我在亞馬遜的在線技能測試人員處調用它時,都會出現以下錯誤:在調用Alexa技能時出現錯誤400

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" 
    } 
    ] 
} 

任何幫助,將不勝感激。

+0

什麼是端點? SSL證書配置是否正確? – Alasdair

+0

端點是[https://echo-btc.herokuapp.com](https://echo-btc.herokuapp.com)。它使用Heroku的通配證書,我之前沒有使用過這個證書。 – HeyItsShuga

回答

0

所以問題不在於代碼,而在於亞馬遜的Alexa技能測試工具。

The Issue