2017-12-22 22 views
0

나는 내 봇을 이미 Lex에서 만들었습니다.어떻게 api 요청을 보내고 boto3을 사용하여 답변을 얻을 수 있습니까?

저는 파이썬에서 요청 (문장)을 보내고 답을 파싱하려고합니다. 그 목적을 위해

, 내가 지금 읽고 이러한 문서를 다시 읽기 시간을 보냈다 : https://boto3.readthedocs.io/en/latest/reference/services/lex-runtime.html#LexRuntimeService.Client.generate_presigned_url

을하지만 이러한 요청을 전송하고 어떤 기능을하는 것은 실제로 나에게 봇에서 답을 줄 것이다 방법을 이해 수없는 것.

답변

0

post_text() 시도해 봤습니까?

import boto3 
client = boto3.client('lex-runtime') 
response = client.post_text(
    botName='string', 
    botAlias='string', 
    userId='string', 
    sessionAttributes={ 
     'string': 'string' 
    }, 
    requestAttributes={ 
     'string': 'string' 
    }, 
    inputText='string' 
) 

이 기능은 당신에게 봇에서 답을 줄 것이다 그것은 response 변수에 저장됩니다.
람다 함수에 코드를 작성하고 Lex에 액세스 할 수있는 권한을 부여하십시오.

도움이 되길 바랍니다.

+0

'string'대신 값을 입력해야합니다. – sid8491

+0

코드 및 오류로 질문을 업데이트하십시오. – sid8491