So I'm trying to develop a skill in Alexa that uses voice recognition. I have the setting enabled on my end, but the problem is grabbing the necessary information in Python. I've read this and also read the example in JavaScript. How do I call the Alexa to run the voice recognition service in python? I'm trying to basically translate the JavaScript code in that one link to Python.
While this isn't what I'm exactly trying to accomplish it starts somewhere.
class SomeIntentHandler(AbstractRequestHandler):
def can_handle(self, handler_input):
return ask_utils.is_intent_name("SomeIntentHandler")(handler_input)
def handle(self, handler_input):
# type: (HandlerInput) -> Response
person = handler_input.request_envelope.context.system.person
consentToken = handler_input.request_envelope.context.system.apiAccessToken
if(person):
speak_output = "Grabbing profile"
else:
speak_output = "Not a person"
return (
handler_input.response_builder
.speak(speak_output)
.ask(speak_output)
.response
)
My output is basically saying that it is an error.
CodePudding user response:
To use the Person Profile API for an Amazon Alexa skill in Python, you'll need to do the following:
- Create an Amazon Developer account and set up an Alexa skill.
- Obtain an API key for the Person Profile API.
- Use the Alexa Skills Kit SDK for Python to interact with the Alexa service and handle the incoming requests and responses.
- Use the requests library in Python to make API calls to the Person Profile API, passing in the necessary authentication information such as the API key.
- Use the responses from the API to customize the skill's behavior based on the user's profile information.
- Handle errors and exceptions that may occur during the API call, and provide appropriate responses to the user.
- Test your skill and submit it for certification.
It's important to note that the Person Profile API is not public available yet and currently in developer preview, so you need to apply for access and be whitelisted to use the API.